[Share Experiences] UOS 系统根分区迁移到btrfs文件系统
Tofloor
poster avatar
zxhyp
deepin
2024-02-02 16:51
Author

UOS系统默认带一个rootb分区用来备份还原用。可以当前根分区迁移到Rootb分区。

1. 格式化rootb分区为btrfs

获取roota,rootb分区设备节点和uuid

# blkid

PARTLABEL="primary" PARTUUID="defcf3e3-78ff-474f-9f3f-a63530fa24b4"

/dev/nvme0n1p5: LABEL="Roota" UUID="40af52fe-2d5b-451f-af6f-b9076313cf6b" TYPE="ext4" PARTLABEL="primary" PARTUUID="a55ed251-6448-410f-8558-4d86fa7a9bc6"

/dev/nvme0n1p6: LABEL="Rootb" UUID="5da9eb85-ac27-48e8-8c0e-72fc69ac4f0c" TYPE="ext4" PARTLABEL="primary"

格式化分区

# mkfs.btrfs -f /dev/nvme0n1p6

挂载分区到 /mnt/btrfs

# cd /mnt &&mkdir /mnt/btrfs

# mount  /dev/nvme0n1p6 /mnt/btrf

新建subvolume

# btrfs subvolume create @

2. 将当前根分区迁移到btrfs分区

# sudo rsync -avxHAX --progress /

3. 更新grub

rootb格式化后uuid会变化,再查询一次uuid

$ blkid

/dev/nvme0n1p6: UUID="1a4b9ebb-827c-42d8-a5bc-45a33f32be42" UUID\_SUB="9f5a0c21-d05a-4ec4-980e-9ea6a73c0bf0" TYPE="btrfs" PARTLABEL="primary" PARTUUID="19853c98-4757-47bc-bd3c-6179108dcabf"

grub增加btrfs选项

# cat /etc/grub.d/40_custom

图片1.png

4. 更新btrfs分区的etc/fstab


图片2.png

# sudo update-grub

5. 重启,选择btrfs分区启动项


图片3.png

Reply Favorite View the author
All Replies

No replies yet