3933
Comment:
|
4465
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
* Links: [[docker/docker-btrfs]] , [[linux/btrfs/crash201706]] | * Links: [[Linux/Btrfs/UbuntuExt4ToBtrfs]], [[docker/docker-btrfs]] , [[linux/btrfs/crash201706]] , [[https://wiki.debian.org/Btrfs]] |
Line 19: | Line 19: |
#Monitor progress with btrfs balance status / |
|
Line 88: | Line 90: |
* if single disk in raid1 fails, best course of action if you can replace the broken disk immediately is to convert to single drive. {{{ btrfs balance start -dconvert=single -mconvert=dup /whatever }}} |
|
Line 104: | Line 109: |
== Check disk with smartctl == * Check with systemctl {{{ sudo btrfs filesystem show sudo apt install smartmontools sudo systemctl start smartd sudo smartctl -H /dev/sda2 }}} |
BTRFS filesystem
Links: Linux/Btrfs/UbuntuExt4ToBtrfs, docker/docker-btrfs , linux/btrfs/crash201706 , https://wiki.debian.org/Btrfs
Btrfs space calculator http://carfax.org.uk/btrfs-usage/
- MODE: single=use all, raid0=smallest disk striped, raid1=2copy(smallest of biggest disk and rest)
- 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 / #Monitor progress with btrfs balance status /
- Add more hd's
- 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
- this disables cow(fragmentation) and also crc calculations on the files.
- 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 / sudo btrfs device stats /
- Resize
- Increase the partition (lvm or fdisk)
find the <devid> (disk number) # btrfs filesystem show
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
- Remove a drive for a array. Can take long, as data is moved off.
btrfs fi show btrfs device delete /dev/sde1 /
if single disk in raid1 fails, best course of action if you can replace the broken disk immediately is to convert to single drive.
btrfs balance start -dconvert=single -mconvert=dup /whatever
Problem with filesystem full
- 2016-03 a big struggle with a full btrfs root fs and then corrupt grub2 on top of the problem.
grub rescue>
used >set prefix=hd(0,1)/@snapxxxxx/boot/grub
- This loaded old non corrupt grub2 normal module and typing normal, loaded old bootloader yeah for btrfs.
- then at the grub2 menu, edit the boot parameters to put root at /@ and load newer kernel from corrupt root fs.
- Space Solved with removing snapshots and deleting some files, then re-balance.
- To delete snapshot's you need to mount disk to get to subvolumes.
- No space to create dir, mount over root with mount /dev/sda1 /root
- Delete subvolumes with #btrfs subvolume delete /root/@snapshot*
- To delete snapshot's you need to mount disk to get to subvolumes.
HP Server Raid tools
Check disk with smartctl
Check with systemctl
sudo btrfs filesystem show sudo apt install smartmontools sudo systemctl start smartd sudo smartctl -H /dev/sda2
...