Differences between revisions 5 and 14 (spanning 9 versions)
Revision 5 as of 2015-07-02 18:59:49
Size: 1429
Editor: PieterSmit
Comment:
Revision 14 as of 2016-02-26 08:53:10
Size: 2825
Editor: PieterSmit
Comment: Add no space left problem.
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
 * Btrfs space calculator http://carfax.org.uk/btrfs-usage/
 * Create a raid1 mirror disk setup raid1 for both data and metadata
   {{{ mkfs.btrfs -m raid1 -d raid1 /dev/sdb /dev/sdc /dev/sdd /dev/sde }}}
   * Now find uuid with {{{ sudo blkid /dev/sd* }}}
     * Add more hd's
       {{{
       btrfs device scan
       btrfs device add /dev/sdc2 /
       btrfs filesystem balance /
       btrfs balance start -dconvert=raid1 -mconvert=raid1 /

       }}}
Line 33: Line 45:

== Install on multi disk ==
 * Will install on multiple disks
   {{{
   sudo dpkg-reconfigure grub-pc }}}
 * Use uuid , same for all disks.
   {{{
   sudo blkid /dev/sd* }}}

== BTRFS maintenace ==
 * SCRUB disks in background, recovering for good copy in raid1 config
   {{{
   sudo btrfs filesystem show
   sudo btrfs filesystem df /
   sudo btrfs scrub start /
   sudo btrfs scrub status -d /
   }}}
 * Resize
   1. Increase the partition (lvm or fdisk)
   2. find the <devid> (disk number) # btrfs filesystem show
   3. btrfs filesystem resize <devid>:max /

 * Error trying to convert to raid0
   {{{
   # btrfs balance start -dconvert=raid0 /home
   ERROR: error during balancing '/home' - No space left on device
   In dmesg btrfs: 262 enospc errors during balance
   }}}
   * FIX
  {{{
  sudo btrfs fi balance start -dusage=10 /
  btrfs balance start -dconvert=raid0 /home
  }}}

BTRFS filesystem

  • Btrfs space calculator http://carfax.org.uk/btrfs-usage/

  • Create a raid1 mirror disk setup raid1 for both data and metadata
    •  mkfs.btrfs -m raid1 -d raid1 /dev/sdb /dev/sdc /dev/sdd /dev/sde 

    • Now find uuid with  sudo blkid /dev/sd* 

      • Add more hd's
        •        btrfs device scan
                 btrfs device add /dev/sdc2 /
                 btrfs filesystem balance /
                 btrfs balance start -dconvert=raid1 -mconvert=raid1 /
  • reflinks
    •  cp --reflink name1 name4 

    • reflinks are supported by BTRFS and OCFS2 and support transparent copy on write which is especially useful for snapshotting.
    • Note that since separate inodes are used, one can have different permissions to access the same data.
    • Reflinks have the same use as hardlinks, but are more space efficient and generally handle all subsequent operations on a file, not just unlink().
  • If you have virtual images on a btrfs, cow(copy on write) will cause a lot of fragmentation, turn it of for the directory of file with
    • this disables cow(fragmentation) and also crc calculations on the files.
      •      chatter +C /path
  • defrag with
    •    btrfs filesystem defragment /path/file
    • or faster for large files
      •      cp --reflink=never vbox.vdi vbox.new.vdi ; rm vbox.vdi ;      
  • Create raid array, raid1 all data mirrored once.
    • # mkfs.btrfs -m raid1 -d raid1 -L root /dev/disk/by-label/root1 /dev/disk/by-label/root2 /dev/disk/by-lab

el/root3 /dev/disk/by-label/root4

  • Mount options, add compress
  • subvolumes
    • mount option subvol=homevol

Install on multi disk

  • Will install on multiple disks
    •    sudo dpkg-reconfigure grub-pc 
  • Use uuid , same for all disks.
    •    sudo blkid /dev/sd* 

BTRFS maintenace

  • SCRUB disks in background, recovering for good copy in raid1 config
    •    sudo btrfs filesystem show
         sudo btrfs filesystem df /
         sudo btrfs scrub start /
         sudo btrfs scrub status -d /
  • Resize
    1. Increase the partition (lvm or fdisk)
    2. find the <devid> (disk number) # btrfs filesystem show

    3. btrfs filesystem resize <devid>:max /

  • Error trying to convert to raid0
    •    # btrfs balance start -dconvert=raid0 /home
         ERROR: error during balancing '/home' - No space left on device
         In dmesg  btrfs: 262 enospc errors during balance
    • FIX
    •   sudo btrfs fi balance start -dusage=10 /
        btrfs balance start -dconvert=raid0 /home

HP Server Raid tools

...

linux/btrfs (last edited 2024-05-20 07:33:10 by PieterSmit)