Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hello, My current system runs openSUSE 12.3 using 2 disks: /dev/sda: 2000.4 GB /dev/sdb: 1000.2 GB The OS resides in sdb, and sda is used for /media. I have 2 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2014
    Posts
    7

    Upgrading from openSUSE 12.3 to Ubunto 14.04 while reshuffling disks


    Hello,

    My current system runs openSUSE 12.3 using 2 disks:
    /dev/sda: 2000.4 GB
    /dev/sdb: 1000.2 GB

    The OS resides in sdb, and sda is used for /media.

    I have 2 new disks and would like to get the following outcome:
    /dev/sda: 256 GB SSD - OS - Ubunto 14.4
    /dev/sdb: 3 GB - /media
    /dev/sdc: 2 GB - /media2
    /dev/sdd: 1 GB - /media3

    My initial thought was to take out the 2 current disks, install the 2 new ones, do a fresh install of Ubunto on the SSD, then plug in the 2 older disks and.., that's where I'm not sure whether I'll be able to reconfigure the disks and their partitions as outlined above.

    What would be the recommended course of action to accomplish that?

    Thanks,
    Nati

    P.S.: Once the above task is successful, I still have to make sure that all the configurations of sabnzbd+sickbeard+couchpotato are transferred intact to the new setup.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,382
    Hi and welcome

    Your idea will work.
    After the fresh installation of ubuntu 14.04 on the ssd,
    I would add the three harddiscs and get their UUIDs
    e.g.:
    Code:
    blkid /dev/sdb1
    blkid /dev/sdc1
    blkid /dev/sdd1
    You can use the UUIDs and mount them to the directories of yourt choice, e.g.:
    Code:
    mkdir /media1
    mkdir /media2
    mkdir /media3
    
    In /etc/fstab
    UUID=a9f7f0e6-dd03-47fc-9320-670f32b23231 /media1            ext4    noatime        0       0
    UUID=a9f7f0e6-dd03-47fc-9320-670f32b23232 /media2            ext4    noatime        0       0
    UUID=a9f7f0e6-dd03-47fc-9320-670f32b23233 /media3            ext4    noatime        0       0


    Additional note:
    If you dislike the enumeration of the media directories, then you could use bindmounts as an abstraction layer.
    e.g.
    Code:
    mkdir -p /media/{photos,records)
    mkdir /media1
    mkdir /media2
    <add the mountpoints in /etc/fstab via UUID as before>
    mount /media1
    mount /media2
    mkdir /media1/photos
    mkdir /media2/records
    
    <Add to /etc/fstab>
    /media1/photos  	/media/photos	none	bind	0	0
    /media2/records  	/media/records	none	bind	0	0
    
    mount /data/photos
    mount /data/records
    Why the additional effort?
    a) /media looks nicer than /media1
    b) Configuration of media tools and backup can always point to /media/*, regardless on which disk the data really is
    c) replacing a disk with a e.g. a bigger one is easily possible. Copy the data, then reconfigure the bindmount.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    May 2014
    Posts
    7
    Thanks.

    Should I unmount /media (on the larger hd) and /home (on the smaller one) before shutting the computer?
    In your example above, after I edit /etc/fstab, will all the data currently on the older drives be available intact on the new mount points?
    Should there be a format step for the new 3TB disk?

    Regarding bindmounts: Is this similar to lvm? Will the data on the "merged" /media be scattered on all disks, resulting in loss of data should one of them fail?

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,382
    If you shutdown your computer, then all mounted filesystems will be unmounted as part of the shutdown process.

    Yes, data will be there regardless of the mountpoint. (As long as you dont delete files, repartition or format the drive)
    Especially on the 1TByte drive there will be multiple partitions. Probably /, /boot/ /home <swap>, potentially /var or /tmp
    I would suggest to mount these old system partitions to temporary directories (e.g. /mnt/old_system for the root partition and then /mnt/old_system/home for the old device and your old home dir)

    The new 3TByte drive needs to be partitioned and formated. Be sure to use the correct disc..


    The bindmount is not like lvm.
    lvm deals with blockdevices.
    mount (usually) attaches the filesystem within a device to the directory tree.
    A bindmount attaches the filesystem within a directory to another directory.

    So you essentially just create a "hub" of directories in /media/, which are on your *ssd*.
    But everything inside each of the bindmounted directories is on one specified disk.

    In regards of data safety:
    It is on the same level as your original approach:
    /dev/sdb: 3 GB - /media
    /dev/sdc: 2 GB - /media2
    /dev/sdd: 1 GB - /media3
    ie: If one of the drives fails, then the data inside is gone.
    Last edited by Irithori; 05-02-2014 at 02:56 PM.
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    May 2014
    Posts
    7
    I dived in quite a few hours ago...

    The hardware and OS parts went rather smoothly, but I fear I may went astray afterwards.

    Using the Disks utility I formatted the 3GB disk (/dev/sdb1) and labeled its file system as "media" (however it reads "Mounted at /media/nati/72cc1496-74bc-4f81-8842-a9273c86f3ae").

    Then, I moved unto it most of the folders which were previously on the 2GB disk.

    It occurred to me now that I should have created a directory "/media" and mount it to /dev/sdb1, and only then move into it all the data.

    Can the process be salvaged...?
    Last edited by Nati; 05-02-2014 at 10:51 PM.

  6. #6
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    It occurred to me now that I should have created a directory "/media" and mount it to /dev/sdb1,
    That would probably create problems as Ubuntu generally automounts and disk under /media. You could create /media/sdb1 and mount it there. A default install of Ubuntu (as most any Linux distribution) will have a /media directory. If you tried to create a media directory in the / of the filesystem, you would likely have got an error message directory media already exists.

    /media/nati/72cc1496-74bc-4f81-8842-
    The long series of letters/numbers above is the device UUID and it is auto-mounting. If you want it to be mounted somewhere else, say /media/sdb1, then you would create the mount point sdb1 under /media and then put an entry in the /etc/fstab file for it. Since you know where the data is and how to access it, I'm not sure what the problem is?

  7. #7
    Just Joined!
    Join Date
    May 2014
    Posts
    7
    Just to verify, if I unmount the disks which were auto-mounted to specific directories under /media/nati, create new directories (/media1, /media2, etc.) and mount each disk to one of the new directories, should all the data in the actual disk appear intact under the new directories?

    Just tried to do the above..:
    Unmount was ok, but cannot mount to /media2:

    Error mounting system-managed device /dev/sdc1: Command-line `mount "/media2"' exited with non-zero exit status 32: [mntent]: line 9 in /etc/fstab is bad
    mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
    missing codepage or helper program, or other error
    In some cases useful info is found in syslog - try
    dmesg | tail or so

    (udisks-error-quark, 0)

    while fstab is as follows:

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    # / was on /dev/sda2 during installation
    UUID=03164883-6800-42d3-8362-957007e05c30 / ext4 noatime, errors=remount-ro 0 1
    # /boot/efi was on /dev/sda1 during installation
    UUID=1B96-E8DE /boot/efi vfat defaults 0 1
    # swap was on /dev/sda3 during installation
    UUID=64cb41da-22fa-4e68-8281-c2bcb79de6dd none swap sw 0 0
    # media2 = 2 GB disk
    UUID=9279df3c-8d85-4084-a82e-5e65d0e0b899 /media2 ext4 0 0
    #
    # Modification for SSD
    #tmpfs /var/log tmpfs defaults,noatime 0 0
    tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
    Last edited by Nati; 05-03-2014 at 06:52 AM.

  8. #8
    Just Joined!
    Join Date
    May 2014
    Posts
    7
    update:
    After adding noatime for /media2 in /etc/fstab, I was able to mount the 2GB through Disks utility.
    But, /etc/fstab now looks as follows:

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    # / was on /dev/sda2 during installation
    UUID=03164883-6800-42d3-8362-957007e05c30 / ext4 noatime, errors=remount-ro 0 1
    # /boot/efi was on /dev/sda1 during installation
    UUID=1B96-E8DE /boot/efi vfat defaults 0 1
    # swap was on /dev/sda3 during installation
    UUID=64cb41da-22fa-4e68-8281-c2bcb79de6dd none swap sw 0 0
    # media2 = 2 GB disk
    #
    # Modification for SSD
    #tmpfs /var/log tmpfs defaults,noatime 0 0
    tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

    I no longer get the error upon boot regarding failure to mount /media2, but I'm not sure that the 2 disks are actually mounted upon boot, since when opening nautilus it performs mount for each when I click on them.

    So, I have the following directory structure, which as said is updated after browsing with the folder utility.

    nati@linux-server:/media/nati$ ls -l
    total 12
    drwxr-xr-x 5 root root 4096 נוב 2 22:17 48977f86-cd32-4004-af20-23951b27fbcd
    drwx------ 9 nati nati 4096 מאי 3 01:34 Media1
    drwxr-xr-x 5 nati root 4096 מאי 3 01:34 Media2

    All the old files are under Media1 and Media2.

    What should I do to properly auto-mount the 2 disks, even in their current places?

  9. #9
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    Originally, the disks were auto-mounting under /media/nati per post 7. You then indicate you created mount points media1, media2. Where? Under /media/nati or in the / of the filesystem? The fstab entry from post 7 below would indicate it is in the / of the filesystem, correct?

    UUID=9279df3c-8d85-4084-a82e-5e65d0e0b899 /media2 ext4 0 0
    The fstab entry in post 8 does not contain any entries for the /media mount points you referred to earlier but only the /, /boot and swap on sda1 while what you are trying to mount is on sdc1. So they would not be mounted on boot. My earlier comment about auto-mounting wasn't quite right. Generally, when you boot with Ubuntu and have external devices attached they are detected and show under the /media directory by uuid number. Clicking on them in a file manager like nautilus will mount them and make them accessible.

    All the old files are under Media1 and Media2.
    I don't know what the above means? First off, have you created media1, media2, etc. in the / of the filesystem or under /media/nati? If the latter, you need that path in your fstab entry. Your ls -l command output would indicate /media/nati. Also it shows Media1 and Media2 not media1 and media2. Your ls -l output shows an upper case Letter M which you need in your fstab and mount command due to case sensitivity. You also seem to have some strange characters to the left of Media1/Media2.

  10. #10
    Just Joined!
    Join Date
    May 2014
    Posts
    7
    I went back to the drawing board (the beginning of this thread), and realized that it's best to ignore the Disks utility and do it all with the Terminal.
    I also made sure to use lower-case across the board.

    The / directory now looks as follows:
    nati@linux-server:/$ ls -l
    total 104
    drwxr-xr-x 2 root root bin
    drwxr-xr-x 4 root root boot
    drwxrwxr-x 2 root root cdrom
    drwxr-xr-x 16 root root dev
    drwxr-xr-x 144 root root etc
    drwxr-xr-x 4 root root home
    lrwxrwxrwx 1 root root initrd.img -> boot/initrd.img-3.13.0-24-generic
    drwxr-xr-x 23 root root lib
    drwxr-xr-x 2 root root lib64
    drwx------ 2 root root lost+found
    drwxr-xr-x 3 root root media
    drwxr-xr-x 10 nati nati media1
    drwxr-xr-x 9 nati nati media2
    drwxr-xr-x 2 nati nati media3
    drwxr-xr-x 2 root root mnt
    drwxr-xr-x 2 root root opt
    dr-xr-xr-x 228 root root proc
    drwx------ 5 root root root
    drwxr-xr-x 26 root root run
    drwxr-xr-x 2 root root sbin
    drwxr-xr-x 2 root root srv
    dr-xr-xr-x 13 root root sys
    drwxrwxrwt 5 root root tmp
    drwxr-xr-x 10 root root usr
    drwxr-xr-x 13 root root var
    lrwxrwxrwx 1 root root vmlinuz -> boot/vmlinuz-3.13.0-24-generic

    Then I changed /etc/fstab as follows:
    nati@linux-server:/$ cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    # / was on /dev/sda2 during installation
    UUID=03164883-6800-42d3-8362-957007e05c30 / ext4 noatime, errors=remount-ro 0 1
    # /boot/efi was on /dev/sda1 during installation
    UUID=1B96-E8DE /boot/efi vfat defaults 0 1
    # swap was on /dev/sda3 during installation
    UUID=64cb41da-22fa-4e68-8281-c2bcb79de6dd none swap sw 0 0
    #
    # media1 = 3GB disk
    UUID=72cc1496-74bc-4f81-8842-a9273c86f3ae /media1 ext4 noatime 0 0
    # media2 = 2 GB disk
    UUID=9279df3c-8d85-4084-a82e-5e65d0e0b899 /media2 ext4 noatime 0 0
    #
    # Modification for SSD
    #tmpfs /var/log tmpfs defaults,noatime 0 0
    tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

    And after reboot - both disks were successfully mounted to their designated folders, and all previous files were there intact.
    So simple I banged my head for missing this the first time around (to my defense I guess I might claim that the pseudo auto-mount through Nautilus threw me a curved ball...).

    Onwards to deal with the 1GB disk which holds various OS partitions, plus media files...
    Last edited by Nati; 05-03-2014 at 06:23 PM.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •