meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:fs:btrfs_as_root [2016/04/20 11:06] – niziak | linux:fs:btrfs_as_root [2017/01/18 21:41] (current) – niziak | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| - btrfs utils version 3.17 | - btrfs utils version 3.17 | ||
| - | |||
| - | ===== Conversion ===== | ||
| - | <code bash> | ||
| - | fsck -f /dev/sda1 | ||
| - | fsck -f /dev/sda6 | ||
| - | |||
| - | btrfs-convert /dev/sda1 | ||
| - | </ | ||
| - | |||
| - | Disk usage before conversion: used 1.56GB, free 2.53GB | ||
| - | after conversion: used 1.65GB, free 2.43GB | ||
| - | |||
| - | <code bash> | ||
| - | |||
| - | ===== Update system ===== | ||
| - | Mount new root filesystem: | ||
| - | |||
| - | <code bash> | ||
| - | mount /dev/sda1 /mnt | ||
| - | for i in dev dev/pts proc sys ; do mount --bind /$i /mnt/$i ; done | ||
| - | chroot /mnt | ||
| - | </ | ||
| - | |||
| - | get new UUID of /dev/sda1 using " | ||
| - | mount /dev/sda1 somewhere, go to etc/fstab and update to new UUID: | ||
| - | |||
| - | UUID=a74f5787-aee1-4981-b7e6-fbd3cb6ac919 / | ||
| - | |||
| - | <code bash> | ||
| - | update-grub | ||
| - | grub-install /dev/sda | ||
| - | |||
| - | exit | ||
| - | |||
| - | reboot | ||
| - | </ | ||
| - | |||
| - | and remove Live CD with Gparted | ||
| - | |||
| - | ===== rollback to ext FS ===== | ||
| - | Rollback to ext2 is possible. There is subvolume ext2_saved on filesystem. | ||
| - | <code bash> | ||
| - | To delete backup | ||
| - | <code bash> | ||
| ===== Update to kernel 4 ===== | ===== Update to kernel 4 ===== | ||
| Line 78: | Line 34: | ||
| + | ===== Converting dirs into subvolumes | ||
| + | To make backups, snapshots, moving much easier and faster, every directory you want to backup by snapshot should be a subvolume. Also root filesystem should be created in separate subvolume not in btrfs root. | ||
| + | |||
| + | To distinguish volumes from directories we will use @ character at beginning of subvolume name. This is Ubuntu naming convention for subvolumes. | ||
| + | |||
| + | Proposed subvolumes structure (where / is BTRFS root) | ||
| + | * /@ | ||
| + | * /@home | ||
| + | * /@var | ||
| + | |||
| + | Mount BTRFS filesystem (BTRFS root) to /mnt/btrfs. | ||
| + | |||
| + | ==== root ==== | ||
| + | * take a snapshot of root volume. Name of snapshot is ' | ||
| + | * '' | ||
| + | * delete files on BTRFS root (/ | ||
| + | * make @ subvolume a default root | ||
| + | * update fstab:< | ||
| + | * OR | ||
| + | * get @ subvolume id '' | ||
| + | * set default subvolume to use when system is mounted '' | ||
| + | |||
| + | |||
| + | ==== subdirectories ==== | ||
| + | * On BTRFS root create a new subvolume | ||
| + | * '' | ||
| + | * move files into the new subvolume as if it were a directory | ||
| + | * '' | ||
| + | * '' | ||
| + | * remove old directory | ||
| + | * '' | ||
| + | * update /etc/fstab to mount @home as /home | ||
| + | |||
| + | ===== fstab ==== | ||
| + | Do not use '' | ||
| + | Example working fstab file: | ||
| + | <file | / | ||
| + | UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / | ||
| + | UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / | ||
| + | UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / | ||
| + | UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / | ||
| + | UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / | ||
| + | </ | ||
| + | To prevent systemd to halt system during startup if device is not found (nofail and x-systemd.device-timeout): | ||
| + | <file | / | ||
| + | UUID=< | ||
| + | </ | ||
| + | NOTE: do not use autodefrag - it consumes lots of cpu | ||