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/21 08: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 79: | Line 35: | ||
| ===== Converting dirs into subvolumes | ===== Converting dirs into subvolumes | ||
| - | To make backups, | + | To make backups, |
| To distinguish volumes from directories we will use @ character at beginning of subvolume name. This is Ubuntu naming convention for subvolumes. | To distinguish volumes from directories we will use @ character at beginning of subvolume name. This is Ubuntu naming convention for subvolumes. | ||
| - | Proposed subvolumes structure | + | Proposed subvolumes structure |
| - | /@ | + | |
| - | /@home | + | |
| - | /@var | + | |
| + | |||
| + | Mount BTRFS filesystem (BTRFS root) to /mnt/btrfs. | ||
| ==== root ==== | ==== root ==== | ||
| - | * take a snapshot of root volume | + | * take a snapshot of root volume. Name of snapshot is ' |
| - | * '' | + | * '' |
| - | * make @root subvolume a default root | + | * delete files on BTRFS root (/ |
| - | * update <file | / | + | * make @ subvolume a default root |
| - | | + | * update |
| - | | + | |
| - | | + | * get @ subvolume |
| - | * set | + | * set default subvolume |
| - | * | + | |
| - | * move directory | + | |
| ==== subdirectories ==== | ==== subdirectories ==== | ||
| Line 105: | Line 62: | ||
| * move files into the new subvolume as if it were a directory | * move files into the new subvolume as if it were a directory | ||
| * '' | * '' | ||
| + | * '' | ||
| * remove old directory | * remove old directory | ||
| * '' | * '' | ||
| * update /etc/fstab to mount @home as /home | * 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 | ||