Joe*_*Joe 5 boot grub2 dual-boot fstab
我正在运行 kubuntu 16.04。我搞砸了 UEFI(很久以前),所以它在没有它的情况下启动,但我的 Windows 10 分区无法启动。我现在不在乎这个。
root 在 sda4 上为 30GB,在 sda5 上为 50GB。
一切正常。
我使用 rsync 将 root 复制到 root2,将 home 复制到 home2。我想使用这些新分区来尝试升级 kubuntu,同时保持我的主系统完好无损。
稍后,我想制作另一个 root 和 home 副本仅用于备份(在我预留的其他分区中),并且我希望它也可以启动。
root2 在 sda6 上为 30GB,home2 在 sda7 上为 50GB。
我修改了 root2 上的 /etc/fstab 以反映新的分区标签。
当我尝试使用 root2(从我的 grub 菜单)启动时,我从 busybox 进入了一个 ash shell 并且必须重新启动才能退出它,所以我在 grub 或 Linux 中做错了,看起来它找不到在哪里或什么引导。
它显示了某种追溯,但我不理解它,我也没有看到它抱怨任何事情。
几年前我问过几乎同样的问题,但一直没有弄明白。
在那个问题中有人建议我需要 chroot 到新的根分区并运行 update-grub,因为我没有单独的引导分区。我快速尝试了一下,发现我不知道如何成功地做到这一点。
我应该采取什么步骤来解决这个问题?
细节:
grub 中的根条目(由 grub-customizer 显示)
(这是按原样工作的部分。)
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
Run Code Online (Sandbox Code Playgroud)
/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
Run Code Online (Sandbox Code Playgroud)
新的东西:
(我在将它复制到 root2 后在 root 中进行了内核更新。这就是为什么这里的版本稍旧。一旦启动,我会修复它。)
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
Run Code Online (Sandbox Code Playgroud)
/etc/fstab(在 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
Run Code Online (Sandbox Code Playgroud)
/boot/grub/grub.cfg
您可以/boot/grub/grub.cfg
手动修改引导配置文件(无需进入chroot
)。我已经做到了,我知道它有效。
修改文件以匹配对分区(根分区的 UUID)的引用与您对/etc/fstab
. 我不确定您是否可以使用标签,因此我建议您列出 UUID
sudo blkid
Run Code Online (Sandbox Code Playgroud)
并使用您为根分区的第二个版本找到的值。
您可能会发现获得至少相同大小的第二个驱动器并从原始驱动器克隆到第二个驱动器更容易。'克隆整个驱动器'。然后你不需要修改任何东西,但是当它们都连接时,你不应该从这些驱动器中的任何一个启动计算机。
下载 Clonezilla iso 文件,创建一个实时驱动器(USB 笔式驱动器或 DVD 磁盘),从中启动并克隆。
之后,您可以使用外部盒子中的第二个驱动器进行备份(使用您想要的任何备份方法/工具)。
归档时间: |
|
查看次数: |
342 次 |
最近记录: |