我想安装带有btrfs文件系统的 Ubuntu 服务器(以 RAID1 方式)。
问题是我在安装程序中看不到创建更多子卷的选项。安装程序默认创建两个:@和@home,我也想分开@var, @tmp, ...
有什么选择可以做到这一点吗?也许使用 shell...但我认为安装程序不理解 的子卷功能btrfs,因此您无法安装每个子卷中的每个分区...
小智 3
完成初始安装后,这应该很容易更改。
@,将它们称为@var和@tmp。@var,@var/var将它们移动@var/var/*到@var/*并删除@var/var。对于 也一样@tmp/tmp/。/etc/fstab的新子卷安装点进行修改。/var/tmp@/var和@/tmp来@删除/mnt和/的/mnt原始/mnt/var内容/mnt/tmp。你是对的,安装程序不知道 BTRFS 子卷,18.04 仍然如此。
使用单独的子卷允许在不丢失日志的情况下/var/log/恢复快照。/
列出所有目标文件系统:
mount | grep target
/dev/md-0 on /target type btrfs (rw,noatime,space_cache,subvolid=257,subvol=/@)
/dev/md-0 on /target/home type btrfs (rw,noatime,space_cache,subvolid=258,subvol=/@home)
proc on /target/proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /target/dev type devtmpfs (rw,nosuid,relatime,size=475608k,nr_inodes=118902,mode=755)
Run Code Online (Sandbox Code Playgroud)记下本例中的 btrfs 设备/dev/dm-0。
现在卸载所有已安装的文件系统。
umount /target/dev
umount /target/proc
umount /target/boot/efi
umount /target/home
umount /target/
Run Code Online (Sandbox Code Playgroud)挂载您的平面btrfs 文件系统:
cd /tmp
mkdir work
mount /dev/dm-0 work
cd work
Run Code Online (Sandbox Code Playgroud)验证安装是否正确(应显示@和@home):
ls
@ @home
Run Code Online (Sandbox Code Playgroud)创建额外的子卷 ( @tmp, @var, @var-log)
btrfs subvolume create @tmp
btrfs subvolume create @var
btrfs subvolume create @var-log
Run Code Online (Sandbox Code Playgroud)移动数据
mv @/var/log/* @var-log/
mv @/var/* @var/
# Remove data from tmp
rm @/tmp/* @/tmp/.*
# For 18.04, remove the swapfile since it won't work on btrfs
rm @/swapfile
Run Code Online (Sandbox Code Playgroud)将新的子卷添加到fstab中,设备部分可能与之前的挂载命令不同,从已经存在的挂载点复制设备部分。
...
/dev/mapper/root-root / btrfs noatime,subvol=@ 0 1
/dev/mapper/root-root /home btrfs noatime,subvol=@home 0 2
/dev/mapper/root-root /var btrfs noatime,subvol=@var 0 2
/dev/mapper/root-root /var/log btrfs noatime,subvol=@var-log 0 2
Run Code Online (Sandbox Code Playgroud)卸载
cd /tmp
umount work
sync
Run Code Online (Sandbox Code Playgroud)exit,然后完成安装
安装并配置snapper,这是一个用于自动化快照的好工具。
| 归档时间: |
|
| 查看次数: |
6460 次 |
| 最近记录: |