2

I'm trying to copy root and home to other partitions on my notebook internal drive and then boot from them (root2 and home2).

Once it works, it can be an (almost) live backup or I could upgrade from Kubuntu Trusty to Utopic on the new partitions and smooth out any wrinkles while still having Trusty working in the other partitions so I can continue to get things done.

I copied home too because I don't want to have to deal with things like config file changes in Utopic which might screw up Trusty when I boot back into it.

(I had some fun with that on my other notebook when I upgraded from Oneiric to Precise using a separate partition for root, but just one home. Some things went a bit bonkers.)

It didn't quite work, so I must have missed something.

Here's what I did:

Used gparted to reformat /dev/sda5 and /dev/sda7 as ext4 (which should have cleared out what was on them) and labeled them as root2 and home2 again.

Stopped user tasks that modify files like bittorrent. (But I didn't boot from a live CD, etc.. I made the copies on the running system.)

Used rsync to copy everything with permissions, etc. preserved from root (/dev/sda3) to root2 (/dev/sda5) and from home (/dev/sda6) to home2 (/dev/sda7). (sda3 and sda5 are both the same size as are sda6 and sda7.)

I don't think it makes a difference, but sda3 is labeled "root", sda5 is labeled "root2", sda6 is labeled "home" and sda7 is labeled "home2".

Mounted /dev/sda5 on /media/bigbird/root2

Edited /media/bigbird/root2/etc/fstab and changed the uuids for root and home to the ones for /dev/sda5 and /dev/sda7. (Got them by running ls -l /dev/disk/by-uuid and copy and pasting them.)

Ran grub-customizer which updated the boot menu to show the new OS on /dev/sda5.

Thought I was done and rebooted, selecting the OS on /dev/sda5 on the grub2 menu.

Boot looked fine, but when I ran df, it showed root as /dev/sda3 and home as /dev/sda6 - like nothing had changed.

Mounted /dev/sda5 again and verified that my changes to fstab were still there. They were.

Noticed that /etc/fstab~ was left over from the editing and deleted it.

Tried to get online, but couldn't. My wifi said it was connected, but there was a second instance of the connection available that should not have been there. Tried to connect to that, which appeared to work, but I still couldn't get online.

Rebooted into my original partition (/dev/sda3) - which still works fine and has no problem coming online.

Apparently, I've missed some steps needed to make this work.

Also, I seem to have made my router unhappy because it wouldn't let me connect to the Internet when I booted the new way. I didn't try to just login to the router.

It did seem a little too simple just to copy everything, change fstab, grub, and reboot.

What do I need to do to get this to work?

EDIT:

I have included my fstabs and some other stuff showing what the UUIDs are below.

What looks like the immediate problem is that grub.cfg is messed up on both partitions.

In the first code block below is a snip of it which shows the schizophrenic entry for sda5 with the root partition set correctly, but with the boot image set to use the one on sda3. (Other entries have the same problem.) It may have other errors. I'm not familiar with it enough to know. (FYI: the kernel versions on sda5 are a little old because I have done updates on sda3 since copying it and haven't run the rsyncs again yet.)

I just looked at the grub entry again and I can't see how it worked at all! It looks like it's looking for kernel 46 on sda3 - which doesn't exist. That older kernel is only on sda5 because I haven't run the rsyncs again yet.

This could be something caused by grub-customizer. I don't know. It probably needs to be fixed before looking for other problems.

Since this file is generated, I need to fix it indirectly, but I don't know how to do it.

/boot/grub/grub.cfg snipped:

### BEGIN /etc/grub.d/30_os-prober_proxy ###
menuentry "Kubuntu 14.04.2 LTS (14.04) (on /dev/sda5) Testing/backup" --class gnu-linux --class gnu --class os $menuentry_id_option '$
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  2540779$
        else
          search --no-floppy --fs-uuid --set=root 2540779b-43d7-4e38-a227-68057afceb47
        fi
        linux /boot/vmlinuz-3.13.0-46-generic root=UUID=9aae2d22-4393-436a-a505-130db27e0e55 ro quiet splash $vt_handoff
        initrd /boot/initrd.img-3.13.0-46-generic
}

fstabs and UUID info:

sda3 (current working root partition)

bigbird@ramdass:/etc$ cat 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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda3 during installation
UUID=9aae2d22-4393-436a-a505-130db27e0e55 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda6 during installation
UUID=1be3e600-6582-4fe6-a8bc-b5479f1444b1 /home           ext4    defaults        0       2
# swap was on /dev/sda8 during installation
UUID=3d9fe1af-25fe-4d28-82c9-5c2b4d895b79 none            swap    sw              0       0
bigbird@ramdass:/etc$ 

sda5 (copy of sda3 to be used as a fall back if the upgrade goes south, etc.)

bigbird@ramdass:/media$ sudo mount /dev/sda5 /media/work
bigbird@ramdass:/media$ cd work
bigbird@ramdass:/media/work$ ls
bin   C:\nppdf32Log\debuglog.txt  dev  initrd.img      lib    libnss3.so  opt   run   srv  var      vmlinuz.old
boot  Desktop                     etc  initrd.img.old  lib64  lost+found  root  sbin  usr  vmlinuz
bigbird@ramdass:/media/work$ cd etc
bigbird@ramdass:/media/work/etc$ cat fstab
# /etc/fstab: static file system information.
##JJP Modified for root2 and home2
#
# 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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / is on /dev/sda5 (root2)
UUID=2540779b-43d7-4e38-a227-68057afceb47 /               ext4    errors=remount-ro 0       1
# /home is on /dev/sda7 (home2)
UUID=8e3aca35-c376-4a71-b6be-5c3c063a184b /home           ext4    defaults        0       2
# swap was on /dev/sda8 during installation
UUID=3d9fe1af-25fe-4d28-82c9-5c2b4d895b79 none            swap    sw              0       0
bigbird@ramdass:/media/work/etc$ 

bigbird@ramdass:/media/work/etc$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Apr  9 03:53 0A1258CF1258C0FD -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr  9 03:53 180E32C60E329CA6 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr  9 03:53 1be3e600-6582-4fe6-a8bc-b5479f1444b1 -> ../../sda6
lrwxrwxrwx 1 root root 10 Apr  9 03:53 2540779b-43d7-4e38-a227-68057afceb47 -> ../../sda5
lrwxrwxrwx 1 root root 10 Apr  9 03:53 3d9fe1af-25fe-4d28-82c9-5c2b4d895b79 -> ../../sda8
lrwxrwxrwx 1 root root 10 Apr  9 03:53 8e3aca35-c376-4a71-b6be-5c3c063a184b -> ../../sda7
lrwxrwxrwx 1 root root 10 Apr  9 03:53 9aae2d22-4393-436a-a505-130db27e0e55 -> ../../sda3
lrwxrwxrwx 1 root root 11 Apr  9 03:53 accbe348-0237-436f-b1b8-c642b95ec49c -> ../../sda10
lrwxrwxrwx 1 root root 10 Apr  9 03:53 b8f4a41f-5056-4b06-a190-14f9f1ea0244 -> ../../sda9
bigbird@ramdass:/media/work/etc$
1
  • When grub boots it needs to load stuff from a filesystem on a partition - so unless you have a separate /boot partition you will have two copies. And running update-grub from a running OS will only update the one copy in the current /boot dir. I'm also not sure if /sda[5..] can be set as bootable - it is in an extended partition (sda[1..4] are primary, bootable partitions). It may help (or may not) to know that you can run update-grub on the other OS by way of chroot + mount -t bind commands. Apr 14, 2015 at 9:11

1 Answer 1

1

Try to boot into a DVD of Ubuntu, then mount /dev/sda5 via:

mkdir /tmp/sda5
mount /dev/sda5 /tmp/sda5

Then, after this, edit fstab

nano /tmp/sda5/etc/fstab

And you should look for a line that begins with '/'. This should be /dev/sda5 not /dev/sda3. If it is not, then adjust appropriately. Also make sure that your /home and other settings are correct in the file and pointing to the right partitions.

check them using fdisk:

sudo fdisk -l

or using gparted

sudo apt-get install -y gparted
gksudo gparted

Once fstab is fixed reboot and you should now have root as /dev/sda5

1
  • That's what I thought, but I've double checked fstab on both partitions and they look good to me. I use gparted whenever I do stuff like this - even just to look at what's there. It's a great tool. Since sda5 isn't mounted when I boot normally from sda3, I can just mount sda5 from there without a live CD. I'll see if I can edit my question to include both fstabs.
    – Joe
    Apr 10, 2015 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .