Archive for April, 2014

Wipe a Hard Drive

April 23rd, 2014 Comments off

zero a drive with progress (change 1T to whatever drive size your zeroing):
# dd if=/dev/zero bs=1M | pv -s 1T | dd bs=1M of=/dev/sde

Erase the drive then read back the blocks to check for errors:
# badblocks -svw -t 0x00 /dev/sde

Categories: file systems

BTRFS Cheatsheet

April 20th, 2014 Comments off

Create a RAID 1 style file system across two devices:

mkfs.btrfs -d raid1 -m raid1 /dev/sdl /dev/sdn

Display information about the filesystem

btrfs fi show /mnt/btrfs
btrfs fi df /mnt/btrfs

Check the data while online:

btrfs scrub start /mnt/btrfs
btrfs scrub status /mnt/btrfs

Add a drive

btrfs device add /dev/sda /mnt/btrfs
btrfs balance start -d -m /mnt/btrfs

Remove a drive

btrfs device delete /dev/sdl /mnt/btrfs

Replace a drive

btrfs replace start /dev/sda /dev/sdl /mnt/btrfs

Convert to RAID 1 (both data and metadata)

btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/btrfs
btrfs balance status /mnt/btrfs
Categories: cheatsheet, file systems