Ubuntu 22.04 服务器安装程序没有创建 btrfs 子卷?

Ubuntu 22.04 服务器安装程序没有创建 btrfs 子卷?

今天安装了 Ubuntu 22.04 LTS 服务器,分区选择的是 BTRFS /,下面是我自定义安装时选择的方案:

/boot     2G ext4
/boot/efi 1G fat32
SWAP      4G
/         469.9G btrfs

通过搜索,我发现 ubuntu 曾经在@和下创建了两个单独的子卷@home,但是我检查时没有看到它们:

# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0    62M  1 loop /snap/core20/1587
loop1         7:1    0  79.9M  1 loop /snap/lxd/22923
loop2         7:2    0    47M  1 loop /snap/snapd/16292
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0     1G  0 part /boot/efi
├─nvme0n1p2 259:2    0     2G  0 part /boot
├─nvme0n1p3 259:3    0     4G  0 part [SWAP]
└─nvme0n1p4 259:4    0 469.9G  0 part /
# cat /etc/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>
/dev/disk/by-uuid/8b2ff495-b8b2-4959-a5a4-1f4aa7e85ffe none swap sw 0 0
# / was on /dev/nvme0n1p4 during curtin installation
/dev/disk/by-uuid/4466d07c-a9a8-452b-a970-667f55eff17a / btrfs defaults 0 1
# /boot was on /dev/nvme0n1p2 during curtin installation
/dev/disk/by-uuid/d15e9776-60c0-4e5f-b782-087126cfde2f /boot ext4 defaults 0 1
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/E1C9-D08B /boot/efi vfat defaults 0 1
/swap.img       none    swap    sw      0       0
# mount | grep nvme0n1p4
/dev/nvme0n1p4 on / type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/)

我在安装过程中是否遗漏了什么?

考虑到 Ubuntu 最近切换到了 subquity 安装程序,我不认为这是一个重复,并且安装流程似乎与回答有关该主题的先前问题时有所不同。

答案1

它是带有子卷btrfs的文件系统的标准设置。@@home

@安装到/并且@home安装到/home

看起来它subuiquity不起作用。你可以修复它。从 LiveUSB 启动并从那里运行:

sudo mount /dev/nvme0n1p4 /mnt

运行sudo nano /mnt/etc/fstab,删除此行

 /dev/disk/by-uuid/4466d07c-a9a8-452b-a970-667f55eff17a / btrfs defaults 0 1

并添加以下几行:

/dev/disk/by-uuid/4466d07c-a9a8-452b-a970-667f55eff17a / btrfs subvol=@ 0 0
/dev/disk/by-uuid/4466d07c-a9a8-452b-a970-667f55eff17a /home btrfs subvol=@home 0 0

然后运行:

sudo btrfs sub create /mnt/@
sudo btrfs sub create /mnt/@home
sudo mv /mnt/home/* /mnt/@home
cd /mnt
sudo mv !(@|swapfile) /mnt/@
sync
sudo umount /mnt
sudo mount -o subvol=@ /dev/nvme0n1p4 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys  /mnt/sys
sudo mount /dev/nvme0n1p2 /mnt/boot
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
sudo chroot /mnt
sudo update-grub
exit
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt/boot
sudo umount /mnt

重新启动,如果我没有犯错的话,一切都应该正常。

相关内容