#StackBounty: #boot #dual-boot #grub2 #fstab How can I copy /home and / to new partitions on the same drive which I can boot into for t…

Bounty: 100

I’m running kubuntu 16.04. I messed up UEFI (long ago), so it boots without it, but my Windows 10 partition won’t boot. I don’t care about that at the moment.

root is 30GB on sda4 home is 50GB on sda5.

All that works fine.

I copied root to root2 and home to home2 using rsync. I want to use these new partitions to experiment with upgrading kubuntu while leaving my main system intact.

Later, I want to make another copy of root and home just for backup (in other partitions I have set aside) and I will want that to be bootable as well.

root2 is 30GB on sda6 and home2 is 50GB on sda7.

I modified /etc/fstab on root2 to reflect the new partition LABELs.

When I try to boot using root2 (from my grub menu), I get into an ash shell from busybox and have to reboot to get out of it, so I did something wrong in grub or Linux and it looks like it can’t find where or what to boot.

It displays some sort of traceback, but I don’t understand it and I don’t see it complaining about anything.

I asked almost the same question a few years ago, but never figured it out.

It was suggested in that question that I needed to chroot into the new root partition and run update-grub because I don’t have a separate boot partition. I gave that a quick try and found that I don’t know how to do that successfully.

What steps should I take to resolve this?


Details:

Root entry in grub (displayed by grub-customizer)

(This is the part that works as is.)

recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  a184c235-bbb7-4e0b-86ab-ab8f5d4a2941
else
  search --no-floppy --fs-uuid --set=root a184c235-bbb7-4e0b-86ab-ab8f5d4a2941
fi
        linux   /boot/vmlinuz-4.4.0-112-generic root=UUID=a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 ro  quiet splash $vt_handoff
initrd  /boot/initrd.img-4.4.0-112-generic

/etc/fstab

bigbird@sananda:/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>
# / was on /dev/sda4 during installation
##UUID=a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda5 during installation
##UUID=c81a6925-0631-484c-88d5-245e2e042652 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
##UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
##UUID=eb1774a1-2a44-4f03-8562-26b6339170f0 /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

LABEL=root /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda5 during installation
LABEL=home /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
LABEL=dataspace /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

New stuff:

(I did a kernel update in root after I copied it to root2. That’s why the versions here are slightly older.
Once it boots, I’ll fix that.)

insmod part_gpt
insmod ext2
set root='hd0,gpt6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  caf3cb64-a51a-4298-bf34-5f97fa3b1308
else
  search --no-floppy --fs-uuid --set=root caf3cb64-a51a-4298-bf34-5f97fa3b1308
fi
linux /boot/vmlinuz-4.4.0-104-generic root=UUID=caf3cb64-a51a-4298-bf34-5f97fa3b1308 ro quiet splash $vt_handoff
initrd /boot/initrd.img-4.4.0-104-generic

/etc/fstab (on sda6)

bigbird@sananda:/media/work/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>
# / on /dev/sda6
##UUID=caf3cb64-a51a-4298-bf34-5f97fa3b1308 /               ext4    errors=remount-ro 0       1
# /home on /dev/sda7
##UUID=a75b6be1-5336-4eaf-92db-da1393b3d412 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
##UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
##UUID=eb1774a1-2a44-4f03-8562-26b6339170f0 /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

LABEL=root2 /               ext4    errors=remount-ro 0       1
# /home on /dev/sda7
LABEL=home2 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
LABEL=dataspace /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1
bigbird@sananda:/media/work/etc$

bigbird@sananda:~/pq$ ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 11 Jan 11 21:43 dataspace -> ../../sda12
lrwxrwxrwx 1 root root 10 Jan 11 21:43 ESP -> ../../sda1
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home -> ../../sda5
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home2 -> ../../sda7
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home_bak -> ../../sda9
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root -> ../../sda4
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root2 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root_bak -> ../../sda8
lrwxrwxrwx 1 root root 11 Jan 11 21:43 winbak -> ../../sda11
lrwxrwxrwx 1 root root 10 Jan 11 21:43 Windows10 -> ../../sda3
bigbird@sananda:~/pq$

bigbird@sananda:~/pq$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 11 Jan 11 21:23 3ef9528c-1927-40fd-8729-33506d440101 -> ../../sda10
lrwxrwxrwx 1 root root 10 Jan 11 21:23 4630B96A30B9619B -> ../../sda3
lrwxrwxrwx 1 root root 10 Jan 11 21:23 52B7-E591 -> ../../sda1
lrwxrwxrwx 1 root root 11 Jan 11 21:23 7E8C3007301FA4AD -> ../../sda11
lrwxrwxrwx 1 root root 10 Jan 11 21:23 8f034ecf-5d98-4753-80d1-8099cf3bb641 -> ../../sda9
lrwxrwxrwx 1 root root 10 Jan 11 21:23 a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 -> ../../sda4
lrwxrwxrwx 1 root root 10 Jan 11 21:23 a75b6be1-5336-4eaf-92db-da1393b3d412 -> ../../sda7
lrwxrwxrwx 1 root root 10 Jan 11 21:23 c81a6925-0631-484c-88d5-245e2e042652 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jan 11 21:23 caf3cb64-a51a-4298-bf34-5f97fa3b1308 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jan 11 21:23 cce6b9f2-1dcc-4a53-b15b-73c595c2f6f5 -> ../../sda8
lrwxrwxrwx 1 root root 11 Jan 11 21:23 eb1774a1-2a44-4f03-8562-26b6339170f0 -> ../../sda12


Get this bounty!!!

Leave a Reply