我添加了 3 个要在启动时挂载的分区,但我在其他地方找到的有关新 fstab 语法的建议只与我的 fstab 中现有的两种样式之一一致,这让我非常困惑。我在其他地方找到的建议是,
Entry in /etc/fstab:
<UUID> <mount directory> <FS type> <mount options> <dump> <pass>
Example:
UUID=5caaee32-c3d3-429e-bad7-2898cf923805 /data ext4 defaults 0 0
但是我的 /etc/fstab 的内容显示,
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/disk/by-uuid/42301925-9786-4ab8-b56c-a3252accf5ef / ext4 defaults 0 1
/dev/disk/by-uuid/F759-075A /boot/efi vfat defaults 0 1
/dev/disk/by-uuid/df063034-c8da-4f14-b1c8-52cdccecc06f /tmp ext4 defaults 0 2
UUID=da0ad11a-8fd7-431a-a49a-d883037aa2c8 /LamaSpace ext4 defaults 0 2
/dev/disk/by-uuid/4acdc978-c30b-4b3f-bbf6-0b7b99094463 /home ext4 defaults 0 2
请注意,只有我的 /LamaSpace 分区使用上面给出的语法;其他分区使用 /dev/disk/by-uuid/ ... 其他语法相同。这两个习语是等效的吗?
额外信息:我使用的是 Ubuntu 24.04。我的所有分区都在一个 8 TB Barracuda HDD 中:
$ blkid
/dev/sda3: UUID="42301925-9786-4ab8-b56c-a3252accf5ef" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="1f981653-4a7f-48ff-958e-d9e7ec1de51e"
/dev/sda1: UUID="F759-075A" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="91e5f592-dc00-455a-af9a-90c3ba7e914b"
/dev/sda2: UUID="da0ad11a-8fd7-431a-a49a-d883037aa2c8" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="fdcdf7ad-c10b-4a98-b730-7a20db907e91"
/dev/sda4: UUID="4acdc978-c30b-4b3f-bbf6-0b7b99094463" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7e2715ef-3ae8-44da-8581-bbcc8c59b9a8"
/dev/sda5: UUID="c2bd1f6c-67af-4ea8-98ef-a9c88d92f433" TYPE="swap" PARTUUID="c703710a-6545-49c2-8845-8be9dfc53e2e"
/dev/sda6: UUID="30DD-1315" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="SpareEFI" PARTUUID="eccf77e6-ee55-4f01-bd05-abf9b9dcc24a"
/dev/sda7: UUID="df063034-c8da-4f14-b1c8-52cdccecc06f" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="NEWTEMP" PARTUUID="c752818c-9dd4-453c-9892-fac0db4a2b4a"
/dev/sda8: UUID="89de958a-8997-44e3-92e0-122e1272675c" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Virtual" PARTUUID="bc89cc7e-0798-4ff7-90cd-cfd36aa9cc6e"
/dev/sda9: UUID="73e18c48-92d7-4f37-b55b-da655f461824" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Sandbox" PARTUUID="5e210dd0-d9fa-4968-a27b-a2753e9c0476"
(我的三个新分区是 sda6、sda8 和 sda9,我手动挂载了它们,但尚未出现在 /etc/fstab 中。)
目前没有区别,但
UUID
更可取。参见man 8 mount
: