[filesystem][archlinux][disk encryption][btrfs] btrfs
fork from here http://www.cnblogs.com/hugetong/p/6914248.html
boot分區,MBR加密:https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Securing_the_unencrypted_boot_partition
首先,我選擇在LUKS上創建btrfs。查看上述文檔的btrfs章節。
1. btrfs不支持swap file,必須使用swap分區 https://wiki.archlinux.org/index.php/Btrfs#Swap_file
2. 不建議在裸盤直接使用btrfs文件系統。https://wiki.archlinux.org/index.php/Btrfs#Partitionless_Btrfs_disk
3. btrfs帶壓縮會提高性能表現。https://wiki.archlinux.org/index.php/Btrfs#Compression
4. 新概念 subvolumes。 https://wiki.archlinux.org/index.php/Btrfs#Subvolumes
這個更詳細,講的更清楚,上邊那個講的很不清楚。。。:https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Subvolumes
btrfs文檔:https://wiki.archlinux.org/index.php/Btrfs (跟上邊那一堆,明明都是一個。。。)
多個磁盤的情況下可以組成一個pool,Btrfs支持 RAID0,1, 10, 5, 6。https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices
5. 不要使用btrfs 的 RAID5, RAID6模式。
6. 常用命令們
https://btrfs.wiki.kernel.org/index.php/Getting_started#Basic_Filesystem_Commands
7. 最大容量 70% ??
Be aware that for that size, it will report full when reaching about 75%.
-----------------------------------------------------------
1. 初始化一個 btrfs 文件系統
1 [email protected] ~ # mkfs.btrfs -L vd_root -f /dev/mapper/vd_root :( btrfs-progs v4.10.2 See http://btrfs.wiki.kernel.org for more information. Label: vd_root UUID: ba0b8b0b-8753-455b-90f6-422f61d59df1 Node size: 16384 Sector size: 4096 Filesystem size: 20.00GiB Block group profiles: Data: single 8.00MiB Metadata: DUP 1.00GiB System: DUP 8.00MiB SSD detected: no Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 20.00GiB /dev/mapper/vd_root [email protected] ~ #
2. 創建一個 subvolume
[email protected] ~ # btrfs subvolume create mnt/real_root Create subvolume ‘mnt/real_root‘
3. 創建快照(很顯然從命令來看,快照也是一個subvolume )
[email protected] ~ # btrfs subvolume snapshot mnt/real_root mnt/snapshot_of_real_root Create a snapshot of ‘mnt/real_root‘ in ‘mnt/snapshot_of_real_root‘
4. 設置default
[email protected] ~ # btrfs subvolume set-default 257 mnt [email protected] ~ # btrfs subvolume get-default mnt ID 257 gen 16 top level 5 path real_root
5. 刪除快照或subvolume
[email protected] ~ # btrfs subvolume list /root/mnt ID 257 gen 22 top level 5 path real_root ID 258 gen 16 top level 5 path snapshot_of_real_root ID 259 gen 22 top level 5 path snapshot/snapshot_of_real_root_2 [email protected] ~ # btrfs subvolume create mnt/test Create subvolume ‘mnt/test‘ [email protected] ~ # btrfs subvolume list /root/mnt ID 257 gen 22 top level 5 path real_root ID 258 gen 16 top level 5 path snapshot_of_real_root ID 259 gen 22 top level 5 path snapshot/snapshot_of_real_root_2 ID 260 gen 24 top level 5 path test [email protected] ~ # btrfs subvolume delete mnt/test Delete subvolume (no-commit): ‘/root/mnt/test‘ [email protected] ~ # btrfs subvolume list /root/mnt ID 257 gen 22 top level 5 path real_root ID 258 gen 16 top level 5 path snapshot_of_real_root ID 259 gen 22 top level 5 path snapshot/snapshot_of_real_root_2 [email protected] ~ #
6. 根據文檔裏的描述, 選用Flat方式創建subvolume
https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Flat
[email protected] ~ # find mnt mnt mnt/real_root mnt/real_root/root mnt/real_root/home mnt/snapshot [email protected] ~ # btrfs subvolume get-default mnt ID 257 gen 30 top level 5 path real_root [email protected] ~ # btrfs subvolume list mnt ID 257 gen 30 top level 5 path real_root ID 261 gen 29 top level 257 path real_root/root ID 262 gen 30 top level 257 path real_root/home [email protected] ~ #
[filesystem][archlinux][disk encryption][btrfs] btrfs