meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:fs:btrfs_as_root [2016/04/21 08:18] niziaklinux: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 
-</code> 
- 
-  Disk usage before conversion: used 1.56GB, free 2.53GB 
-  after conversion: used 1.65GB, free 2.43GB 
- 
-<code bash>btrfs check /dev/sda1</code> 
- 
-===== 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 
-</code> 
- 
-get new UUID of /dev/sda1 using "blkid" 
-mount /dev/sda1 somewhere, go to etc/fstab and update to new UUID: 
- 
-  UUID=a74f5787-aee1-4981-b7e6-fbd3cb6ac919 /               btrfs    defaults 0       1 
- 
-<code bash> 
-update-grub 
-grub-install /dev/sda 
- 
-exit 
- 
-reboot 
-</code> 
- 
-and remove Live CD with Gparted 
- 
-===== rollback to ext FS ===== 
-Rollback to ext2 is possible. There is subvolume ext2_saved on filesystem. 
-<code bash>btrfs subvolume list /</code> 
-To delete backup 
-<code bash>btrfs subvolume delete /ext2_saved</code> 
  
 ===== Update to kernel 4 ===== ===== Update to kernel 4 =====
Line 87: Line 43:
   * /@home   * /@home
   * /@var   * /@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 '@' 
-    * ''btrfs subvolume snapshot @'' +    * ''btrfs subvolume snapshot /mnt/btrfs @'' 
-  * delete files on BTRFS root +  * delete files on BTRFS root (/mnt/btrfs) 
-  * make @root subvolume a default root +  * make @ subvolume a default root 
-    * update fstab:<file | /etc/fstab>UUID=739e6086-d925-4bdb-94f5-26d8c10dc171 / btrfs defaults,subvol=@root</file> +      * update fstab:<file | /etc/fstab>UUID=739e6086-d925-4bdb-94f5-26d8c10dc171 / btrfs defaults,subvol=@</file> 
-    * OR set  @root subvolume default mount path ''btrfs subvolume set-default @root /''+    * OR  
 +      * get @ subvolume id ''btrfs subvolume list /mnt/btrfs'' 
 +      * set default subvolume to use when system is mounted ''btrfs subvolume set-default 256 /mnt/btrfs''
  
  
Line 106: Line 66:
     * ''rmdir /mnt/btrfs/@/home''     * ''rmdir /mnt/btrfs/@/home''
   * update /etc/fstab to mount @home as /home   * update /etc/fstab to mount @home as /home
 +
 +===== fstab ====
 +Do not use ''errors=remount-ro'' option which is not valid for BTRFS.
 +Example working fstab file:
 +<file | /etc/fstab>
 +UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 / btrfs defaults,subvol=@,compress=no 0 0
 +UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 /var btrfs defaults,subvol=@var,compress=no 0 0
 +UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 /var/log btrfs defaults,subvol=@varlog,compress=no 0 0
 +UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 /home btrfs defaults,subvol=@home,compress=no 0 0
 +UUID=ed730508-753e-4a7f-ac1e-bf8646f7bd63 /mnt/btrfs btrfs noauto,defaults,subvolid=5,compress=no 0 0
 +</file>
 +
 +To prevent systemd to halt system during startup if device is not found (nofail and x-systemd.device-timeout):
 +<file | /etc/fstab>
 +UUID=<the_device_uuid> /mount/point btrfs nofail,x-systemd.device-timeout=10,noatime,compress=lzo,autodefrag 0 0
 +</file>
 +NOTE: do not use autodefrag - it consumes lots of cpu