User Tools

Site Tools


software:linux:btrfs

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
software:linux:btrfs [2016/11/11 00:37] superwizardsoftware:linux:btrfs [2016/11/17 03:26] (current) superwizard
Line 1: Line 1:
 +====== Scripts for btrfs maintenance tasks like periodic scrub ======
 +
 +
 +From: https://github.com/kdave/btrfsmaintenance
 +
 +<code>
 +Great Documentation 
 +
 +Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected 
 +mountpoints or directories.
 +</code>
 +
 ====== btrfs check ====== ====== btrfs check ======
  
Line 11: Line 23:
  
 From: http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html From: http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html
 +
 +From: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
  
  
Line 16: Line 30:
 <code> <code>
 btrfs scrub start -Bd $mountpoint btrfs scrub start -Bd $mountpoint
-btrfs check --repair \dev\sb2+ 
 +btrfs scrub is used to scrub a btrfs filesystem, which will read all data and metadata blocks from  
 +all devices and verify checksums. Automatically repair corrupted blocks if there’s a correct copy  
 +available.
  
 start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device> start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>
Line 38: Line 55:
 set IO priority classdata (see ionice(1) manpage) set IO priority classdata (see ionice(1) manpage)
 -f -f
-force starting new scrub even if a scrub is already running, this can useful when scrub status file is damaged and reports a running scrub although it is not, but should not normally be necessary+force starting new scrub even if a scrub is already running, this can useful when scrub status  
 +file is damaged and reports a running scrub although it is not, but should not normally be necessary
 status [-d] <path>|<device> status [-d] <path>|<device>
 +</code>
 +
 +====== resize partition ======
 +
 +From: http://unix.stackexchange.com/questions/239765/how-to-fix-btrfs-superblock-error-after-resize-shrink-btrfs-couldnt-get-super
 +
 +<code>
 +Fix
 +
 +First, a live system was booted to reduce the risk of damage while the system is running on a 
 +filesystem that's bigger than the partition it's on.
 +
 +Mount the filesystem:
 +
 +mount /dev/sda2 /mnt/tmp
 +First shrink the second device to 50 GB - 1 GB = 49 GB to avoid rounding errors:
 +
 +btrfs filesystem resize 2:49g /mnt/tmp
 +Resize it to fill the 50 GB partition:
 +
 +btrfs filesystem resize 2:max /mnt/tmp
 +Check btrfs filesystem show, both devices should have the right size:
 +
 +devid    1 size 50.00GiB used 43.03GiB path /dev/sda2
 +devid    2 size 50.00GiB used 43.03GiB path /dev/sdb2
 +Unmount, reboot, the error should be gone.
 </code> </code>
  
software/linux/btrfs.1478824649.txt.gz · Last modified: by superwizard