Archive for the ‘HOWTOs’ Category

HOWTO: Using ZFS Snapshots

Posted on the July 13th, 2007 under HOWTOs,Sys Admin,Technology / Computing by jglemza

So the time has come that you’d like to protect the current status of your drive and be able to revert back to this state in the future if something bad happens. Enter snapshots.
root@ufuk:~# zfs snapshot shet@13july2007
And now you have it. You have a snapshot of your data. You can see the size of the snapshot by running:
root@ufuk:~# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
shet                     266G   649G   266G  /shet
shet@13july2007          103K      -   266G  -
syspool                 2.77G  32.9G    24K  none
syspool/rootfs          2.77G  32.9G  2.60G  legacy
syspool/rootfs@default   178M      -   648M  -
The size of the snapshot will grow as things change. To recover files from a snapshot, mount it and copy it out of the snapshot.
root@ufuk:~# zfs mount shet@13july2007 /mnt/snapshet
To delete a snapshot, run:
root@ufuk:~# zfs destroy shet@13july2007

HOWTO: Single ZFS Drive to Mirror

Posted on the July 9th, 2007 under HOWTOs,Sys Admin,Technology / Computing by jglemza

My original installation of NexentaCP just had a single drive being used for the system installation. This can be verified here:
root@ufuk:~# zpool status syspool

  pool: syspool
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        syspool     ONLINE       0     0     0
          c0d0s0    ONLINE       0     0     0

errors: No known data errors
I got my hands on another drive and I wanted to mirror this pool. To do this, issue the following command:
root@ufuk:~# zpool attach syspool mirror c0d0s0 c4d1s0
After a couple hours of resilvering, it’s all setup.
root@ufuk:~# zpool status syspool
  pool: syspool
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        syspool     ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            c0d0s0  ONLINE       0     0     0
            c4d1s0  ONLINE       0     0     0

errors: No known data errors
Done. Loving ZFS.

HOWTO: Replace a ZFS Drive

Posted on the July 9th, 2007 under HOWTOs,Sys Admin,Technology / Computing by jglemza

The setup previously described was using 2 SATA drives and 1 IDE drive to complete my RAID-Z pool. However, I’ve just obtained a new SATA drive that I want to use to replace the IDE drive. This can be accomplished very easily. The current pool status is as follows:
root@ufuk:~# zpool status shet
  pool: shet
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        shet        ONLINE       0     0     0
          raidz1    ONLINE       0     0     0
            c1d0    ONLINE       0     0     0
            c2d0    ONLINE       0     0     0
            c4d0    ONLINE       0     0     0

errors: No known data errors
I need to replace c1d0 with c2d1. This is accomplished with the following command:
root@ufuk:~# zpool replace shet c1d0 c2d1
After a couple hours of resilvering, the new drive is up and running.
root@ufuk:~# zpool status shet
  pool: shet
 state: ONLINE
 scrub: scrub completed with 0 errors on Mon Jul  9 00:50:40 2007
config:

        NAME        STATE     READ WRITE CKSUM
        shet        ONLINE       0     0     0
          raidz1    ONLINE       0     0     0
            c2d1    ONLINE       0     0     0
            c2d0    ONLINE       0     0     0
            c4d0    ONLINE       0     0     0

errors: No known data errors
Once again, ZFS proves itself to be incredibly simple.