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:01] – niziak | linux:fs:btrfs_as_root [2017/01/18 21:41] (current) – niziak | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| - | ===== Conversion | + | ===== Update to kernel 4 ===== |
| + | Edit / | ||
| <code bash> | <code bash> | ||
| - | fsck -f /dev/sda1 | + | apt-get update |
| - | fsck -f /dev/sda6 | + | apt-get install linux-image-amd64 |
| - | + | apt-get install | |
| - | btrfs-convert /dev/sda1 | + | update-initramfs -u |
| </ | </ | ||
| - | | + | |
| - | | + | |
| + | * SOLUTION: ln -s / | ||
| - | <code bash>btrfs check /dev/sda1</ | + | Check btrfs-tools version |
| + | <code bash>/bin/btrfs version</ | ||
| - | ===== Update system ===== | ||
| - | Mount new root filesystem: | ||
| - | <code bash> | + | ===== Converting dirs into subvolumes |
| - | mount /dev/sda1 /mnt | + | 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 |
| - | for i in dev dev/pts proc sys ; do mount --bind /$i /mnt/$i ; done | + | |
| - | chroot /mnt | + | |
| - | </ | + | |
| - | get new UUID of /dev/sda1 using " | + | To distinguish volumes from directories we will use @ character at beginning |
| - | mount /dev/sda1 somewhere, go to etc/fstab and update to new UUID: | + | |
| - | UUID=a74f5787-aee1-4981-b7e6-fbd3cb6ac919 | + | Proposed subvolumes structure (where |
| + | * /@ | ||
| + | * /@home | ||
| + | * /@var | ||
| - | <code bash> | + | Mount BTRFS filesystem (BTRFS root) to /mnt/btrfs. |
| - | update-grub | + | |
| - | grub-install | + | |
| - | exit | + | ==== root ==== |
| - | + | * take a snapshot of root volume. Name of snapshot is ' | |
| - | reboot | + | * '' |
| - | </code> | + | * delete files on BTRFS root (/ |
| + | * make @ subvolume a default root | ||
| + | * update fstab:<file | /etc/fstab>UUID=739e6086-d925-4bdb-94f5-26d8c10dc171 / | ||
| + | * OR | ||
| + | * get @ subvolume id '' | ||
| + | * set default subvolume to use when system is mounted '' | ||
| - | and remove Live CD with Gparted | ||
| - | ==== rollback to ext FS ==== | + | ==== subdirectories |
| - | Rollback to ext2 is possible. There is subvolume | + | * On BTRFS root create a new subvolume |
| - | <code bash>btrfs subvolume | + | * '' |
| - | To delete backup | + | * move files into the new subvolume as if it were a directory |
| - | <code bash>btrfs subvolume delete | + | * '' |
| + | * '' | ||
| + | * 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 | ||