Skip to content

Instantly share code, notes, and snippets.

@gordallott
Last active April 5, 2019 00:32
Show Gist options
  • Save gordallott/5b1c3e3ee3d71836f47e777945b5fb66 to your computer and use it in GitHub Desktop.
Save gordallott/5b1c3e3ee3d71836f47e777945b5fb66 to your computer and use it in GitHub Desktop.
zfs-cheat sheet

zfs cheat sheet:

https://github.com/jimsalterjrs/sanoid used for backups

things broke and i want to go back to how they used to be!

i had a problem with an app corrupting it's config file and an lxd container running out of disk space. both were fixed with lxd-restore. sudo zfs rollback -r lxd-containers/containers/axiom@autosnap_2019-02-20_13:00:01_hourly - if using the above crontab setup the restore snapshots should look similar to this a second later my drive was like it was an hour ago with no fuss involved

snapshots can be listed with sudo zfs list -r -t snapshot homeutil/extern

all my zpools vanished and now zfs vanished and nothing works (happened after i added a new disk to the system)

use zpool status to list the existing pools, they will likely say something like

    id: 2704475622193776801
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

        dozer       ONLINE
          c1t9d0    ONLINE

  pool: dozer
    id: 6223921996155991199
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

        dozer       ONLINE
          c1t8d0    ONLINE

use zfs import to import the pools, the zfs stuff should recreate after that

adding a new drive to increase zpool storage size

to increase the storage size of one of my zpools i attached a new drive, ran sudo zpool set autoexpand=on lxd-containers, made sure that the drive had a partition table

$ sudo parted /dev/sdb

GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel GPT
(parted) q
Information: You may need to update /etc/fstab.

then ran sudo zpool add lxd-containers sdb - after that i restarted (lxd needed a restart not zfs) and my container had an increased drive size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment