Login

Run the command "ssh userXX@play.coker.com.au" with password "userXX" where XX is your user number. Change the password after you login.

To access your virtual machine run the command "ssh root@userXX".

BTRFS

  1. Making the filesystem
    1. Make the filesystem, this makes a filesystem that spans 2 devices:
      mkfs.btrfs /dev/xvdd /dev/xvde
    2. Use file(1) to see basic data from the superblocks:
      file -s /dev/xvdd /dev/xvde
    3. Mount the filesystem (can mount either block device, the kernel knows they belong together):
      mount /dev/xvdd /mnt/tmp
    4. See a BTRFS df of the filesystem, shows what type of RAID is used:
      btrfs filesystem df /mnt/tmp
    5. See more information about FS device use:
      btrfs filesystem show /mnt/tmp
    6. Balance the filesystem to change RAID settings and verify the change:
      btrfs balance start -dconvert=raid1 -mconvert=raid1 -sconvert=raid1 --force /mnt/tmp
      btrfs filesystem df /mnt/tmp
    7. See if there are any errors, shouldn't be any (yet):
      btrfs device stats /mnt/tmp
    8. Copy some files to the filesystem:
      cp -r /usr /mnt/tmp
    9. Check the filesystem for basic consistency (only checks checksums):
      btrfs scrub start -B -d /mnt/tmp
    1. Online corruption
    2. Corrupt the filesystem:
      dd if=/dev/zero of=/dev/xvdd bs=1024k count=2000 seek=50
    3. Scrub again, should give a warning about errors:
      btrfs scrub start -B /mnt/tmp
    4. Check error count:
      btrfs device stats /mnt/tmp
    5. Corrupt it again:
      dd if=/dev/zero of=/dev/xvdd bs=1024k count=2000 seek=50
    6. Unmount it:
      umount /mnt/tmp
    7. In another terminal follow the kernel log:
      tail -f /var/log/kern.log
    8. Mount it again and observe it correcting errors on mount:
      mount /dev/xvdd /mnt/tmp
    9. Run a diff, observe kernel error messages and observe that diff reports no file differences:
      diff -ru /usr /mnt/tmp/usr/
    10. Run another scrub, this will probably correct some errors which weren't discovered by diff:
      btrfs scrub start -B -d /mnt/tmp
  2. Offline corruption
    1. Umount the filesystem, corrupt the start, then try mounting it again:
      umount /mnt/tmp
      dd if=/dev/zero of=/dev/xvdd bs=1024k count=200
      mount /dev/xvdd /mnt/tmp
      mount /dev/xvde /mnt/tmp
    2. Note that the filesystem was not mountable due to a lack of a superblock. There are ways of recovering from this but that's more advanced so we will restore the RAID.
      Mount the filesystem in a degraded RAID mode, this allows full operation.
      mount /dev/xvde /mnt/tmp -o degraded
    3. Add /dev/xvdd back to the RAID:
      btrfs device add /dev/xvdd /mnt/tmp
    4. Show the filesystem devices, observe that xvdd is listed twice, the missing device and the one that was just added:
      btrfs filesystem show /mnt/tmp
    5. Remove the missing device and observe the change:
      btrfs device delete missing /mnt/tmp
      btrfs filesystem show /mnt/tmp
    6. Balance the filesystem, not sure this is necessary:
      btrfs balance start /mnt/tmp
    7. Umount and mount it, note that the degraded option is not needed:
      umount /mnt/tmp
      mount /dev/xvdd /mnt/tmp
  3. Experiment
    1. Experiment with the "btrfs subvolume create" and "btrfs subvolume delete" commands (which act like mkdir and rmdir).
    2. Experiment with "btrfs subvolume snapshot SOURCE DEST" and "btrfs subvolume snapshot -r SOURCE DEST" for creating regular and read-only snapshots of other subvolumes (including the root).

ZFS

  1. Installing zfsonlinux
    1. Add the following to /etc/apt/sources.list:
      deb http://archive.zfsonlinux.org/debian jessie main
    2. Run the following commands:
      apt-get update
      apt-get install debian-zfs
      This takes ages
    3. Making the filesystem
      1. Create the pool:
        zpool create -o ashift=12 nyancat raidz /dev/xvdd /dev/xvde /dev/xvdf
        NB You need to add a "-f" to overwrite the BTRFS filesystem
      2. Make some default filesystem settings:
        zfs set devices=off nyancat
        zfs set atime=off nyancat
        zfs set setuid=off nyancat
        zfs set compression=on nyancat
      3. Get information on the pool:
        zfs get all nyancat|less
        zpool list
        zpool status
      4. Make a filesystem:
        zfs create nyancat/friday
        df -h
      5. See if there are any errors, shouldn't be any (yet):
        zpool scrub nyancat
        zpool status
      6. Copy some files to the filesystem:
        cp -r /usr /nyancat/friday
      7. Scrub the filesystem:
        zpool scrub nyancat
        zpool status
      1. Online corruption
      2. Corrupt the filesystem:
        dd if=/dev/zero of=/dev/xvdd bs=1024k count=2000 seek=50
      3. Scrub again, should give a warning about errors:
        zpool scrub nyancat
        zpool status
      4. Verify that the data is intact:
        diff -ru /usr /nyancat/friday/usr
      5. Corrupt it again: