将 Ubuntu 20.04 从 m.2 SSD 克隆到 nvme SSD。克隆后新生成的 nvme 上的 UUID。两者都可以工作,但有以下骑手:
\nnvme ubuntu 的 fstab 中的 UUID 必须是 SSD ubuntu 的 UUID,否则会出现错误“无法启动重新安装根和内核文件系统”。
\n但是两个 Ubuntu 分区都是独立工作的,因为 nvme 版本从原来的 20.04.01 更新到了 20.04.03。SSD 上的版本仍然是 20.04.01。
\n如果在 fstab 中输入相应的 UUID,则两个分区都不会启动。
\n我使用旧版引导 BIOS 并使用 Clover 引导加载程序,两个磁盘上都有 GPT fs。
$ lsblk -o name,size,fstype,label,uuid,mountpoint,model|sed 's/ *$//';\nNAME SIZE FSTYPE LABEL UUID MOUNTPOINT MODEL \nloop0 185.4M squashfs /snap/audacity/920 \nloop1 185.3M squashfs /snap/audacity/922 \nloop2 4K squashfs /snap/bare/5 \nloop3 99.4M squashfs /snap/core/11993 \nloop4 61.9M squashfs /snap/core20/1169 \nloop5 99.5M squashfs /snap/core/11798 \nloop6 55.4M squashfs /snap/core18/2128 \nloop7 219M squashfs /snap/gnome-3-34-1804/66 \nloop8 55.5M squashfs /snap/core18/2246 \nloop9 61.8M squashfs /snap/core20/1081 \nloop10 140K squashfs /snap/gtk2-common-themes/13 \nloop11 65.2M squashfs /snap/gtk-common-themes/1519 \nloop12 219M squashfs /snap/gnome-3-34-1804/72 \nloop13 32.4M squashfs /snap/snapd/13270 \nloop14 51M squashfs /snap/snap-store/542 \nloop15 65.1M squashfs /snap/gtk-common-themes/1515 \nloop16 42.2M squashfs /snap/snapd/13831 \nloop17 164.8M squashfs /snap/gnome-3-28-1804/161 \nloop18 51M squashfs /snap/snap-store/547 \nloop19 162.9M squashfs /snap/gnome-3-28-1804/145 \nsda 119.2G LS_128GB_M300 \n\xe2\x94\x9c\xe2\x94\x80sda1 24G ext4 U20.04 64bit SSD 11bb7e9e-49c9-4e44-bc97-2b501f358e2b \n\xe2\x94\x9c\xe2\x94\x80sda2 555M vfat EFI-SSD 864B-9B3E \n\xe2\x94\x9c\xe2\x94\x80sda3 45G ntfs F894575794571788 \n\xe2\x94\x9c\xe2\x94\x80sda4 102.9M vfat BDU-SSD 64BD-803B \n\xe2\x94\x9c\xe2\x94\x80sda5 500M ext4 2a2cb9ea-cb10-4154-ac48-8c8513559de3 \n\xe2\x94\x94\xe2\x94\x80sda6 49.2G ntfs 6C7A63467A630BE0 \nsdb 29G Storage_Device \n\xe2\x94\x9c\xe2\x94\x80sdb1 200M vfat BDU 7CCC-3457 /boot/efi \n\xe2\x94\x94\xe2\x94\x80sdb2 28.8G \nnvme0n1 232.9G Samsung SSD 970 EVO Plus 250GB \n\xe2\x94\x9c\xe2\x94\x80nvme0n1p1 100M vfat BDU-NVME 4860-509F \n\xe2\x94\x9c\xe2\x94\x80nvme0n1p2 46.5G ext4 U20.04 64bit SSD 5d01e76f-5114-4416-b810-5de33dafa914 / \n\xe2\x94\x94\xe2\x94\x80nvme0n1p3 49.6G ext4 U18 NVME fd23fb07-2a0d-4b9c-962f-1d86f17e32df\n
Run Code Online (Sandbox Code Playgroud)\nSSD 上 ubuntu 20.04 的 fstab
\n#/etc/fstab: static file system information.\n#Use 'blkid' to print the universally unique identifier for a\n#device; this may be used with UUID= as a more robust way to name devices\n#that works even if disks are added and removed. See fstab(5).\n#<file system> <mount point> <type> <options> <dump> <pass>\n#/ was on /dev/sda1 during installation\n#UUID=5d01e76f-5114-4416-b810-5de33dafa914 / ext4 errors=remount-ro 0 1\nUUID=11bb7e9e-49c9-4e44-bc97-2b501f358e2b / ext4 errors=remount-ro 0 1 /swapfile \nnone swap sw 0 0\n#UUID=4860-509F /boot/efi vfat defaults 0 1\n#UUID=4860-509F /boot/efi vfat defaults 0 1\n#UUID=4860-509F /boot/efi vfat defaults 0 1\n#UUID=4860-509F /boot/efi vfat defaults 0 1\n#UUID=B092-D69A /boot/efi vfat defaults 0 1\n#UUID=864B-9B3E /boot/efi vfat defaults 0 1\n#UUID=864B-9B3E /boot/efi vfat defaults 0 1 \n UUID=864B-9B3E /boot/efi vfat defaults 0 1\n
Run Code Online (Sandbox Code Playgroud)\nNVME 上 20.04 的 ubuntu 的 fstab
\n#/etc/fstab: static file system information.\n#Use 'blkid' to print the universally unique identifier for a\n#device; this may be used with UUID= as a more robust way to name devices\n#That works even if disks are added and removed. See fstab(5).\n#<file system> <mount point> <type> <options> <dump> <pass>\n#/ was on /dev/sda1 during installation\nUUID=11bb7e9e-49c9-4e44-bc97-2b501f358e2b / ext4 errors=remount-ro 0 1\n#UUID=5d01e76f-5114-4416-b810-5de33dafa314 / ext4 errors=remount-ro 0 1\n/swapfile none swap sw 0 0\nUUID=4860-509F /boot/efi vfat defaults 0 1\n
Run Code Online (Sandbox Code Playgroud)\n通过查看下面答案中的更新 #1 解决了问题。
\n当您克隆磁盘时,所有内容都会被克隆,包括磁盘和分区 UUID。当两个磁盘同时连接到系统时,这就会成为问题。
\n您需要更改原始磁盘或克隆磁盘上的 UUID。但是,如果更改原始磁盘上的 UUID,则还必须编辑 /etc/fstab。如果更改克隆磁盘上的 UUID,则无需编辑 /etc/fstab(除非克隆磁盘最终安装到系统中,代替原始磁盘,然后需要使用以下内容更新 /etc/fstab):新的 UUID 或 /dev/sdaX 设备名称)。
\n注意:没有理由通过对 /etc/fstab 进行其他编辑来安装原始磁盘和克隆磁盘。克隆磁盘通常用于创建备份,或者从较小的原始磁盘转移到较大的克隆磁盘,然后在系统中进行交换。
\n注意:克隆磁盘启动问题通常可以通过使用来解决boot-repair
。
更改 UUID 需要两个命令。请参阅以下手册页...
\nman uuidgen\nman tune2fs\n
Run Code Online (Sandbox Code Playgroud)\n乌伊德根
\n示例:uuidgen -r
或uuidgen -t
-r, --random\n Generate a random-based UUID. This method creates a UUID con\xe2\x80\x90\n sisting mostly of random bits. It requires that the operating\n system have a high quality random number generator, such as\n /dev/random.\n\n -t, --time\n Generate a time-based UUID. This method creates a UUID based on\n the system clock plus the system's ethernet hardware address, if\n present.\n
Run Code Online (Sandbox Code Playgroud)\n调2fs
\n例子:sudo tune2fs -U new_UUID /dev/sdbX
-U UUID\n Set the universally unique identifier (UUID) of the filesystem\n to UUID. The format of the UUID is a series of hex digits sepa\xe2\x80\x90\n rated by hyphens, like this:\n "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may\n also be one of the following:\n\n clear clear the filesystem UUID\n\n random generate a new randomly-generated UUID\n\n time generate a new time-based UUID\n\n The UUID may be used by mount(8), fsck(8), and /etc/fstab(5)\n (and possibly others) by specifying UUID=uuid instead of a block\n special device name like /dev/hda1.\n\n See uuidgen(8) for more information. If the system does not\n have a good random number generator such as /dev/random or\n /dev/urandom, tune2fs will automatically use a time-based UUID\n instead of a randomly-generated UUID.\n
Run Code Online (Sandbox Code Playgroud)\n更新#1:
\n更正了 NVME 上 ubuntu 20.04 的 fstab
\n注意:fstab 中不能有制表符,只有空格
\n#/etc/fstab: static file system information.\n#Use 'blkid' to print the universally unique identifier for a\n#device; this may be used with UUID= as a more robust way to name devices\n#That works even if disks are added and removed. See fstab(5).\n#<file system> <mount point> <type> <options> <dump> <pass>\n#/ was on /dev/nvme0n1p2 during installation\nUUID=5d01e76f-5114-4416-b810-5de33dafa914 / ext4 errors=remount-ro 0 1\n/swapfile none swap sw 0 0\nUUID=4860-509F /boot/efi vfat defaults 0 1\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
3616 次 |
最近记录: |