Moving zfs datasets / filesystems around

After the zfs send, I had system/foo/bar, but I really just wanted system/bar. How do I fix that? mv(1) was my first guess. I was wrong.

What I wanted was zfs(8) rename.

Let me explain.

After doing my:

zfs send storage/compressed/bacula@2013.07.22:06:33 | mbuffer | ssh -t dan@10.5.0.20 'zfs receive system/usr/local/bacula/FromKraken'

I quite, correctly, wound up with system/usr/local/bacula/FromKraken, not the system/usr/local/bacula which I wanted.

Here’s how I fixed that, but first, I took snapshots, in case I messed up:

# zfs snapshot system/usr/local/bacula@BeforeMovingKrakenUpOneLevel
# zfs snapshot system/usr/local/bacula/FromKraken@BeforeMovingKrakenUpOneLevel

Here is what I started with:

# zfs list | grep bacula
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
system/usr/local/bacula             7.58T  12.6T   347K  /usr/local/bacula
system/usr/local/bacula/FromKraken  7.58T  12.6T  7.51T  /usr/local/bacula/FromKraken

Then I did this:

# zfs rename system/usr/local/bacula system/usr/local/OldBacula
# zfs rename system/usr/local/OldBacula/FromKraken system/usr/local/bacula

Now I have this:

# zfs list | grep -i bacula
system/usr/local/OldBacula   347K  12.6T   347K  /usr/local/OldBacula
system/usr/local/bacula     7.58T  12.6T  7.51T  /usr/local/bacula

And this:

# zfs list -t snapshot | grep -i bacula
system/usr/local/OldBacula@BeforeMovingKrakenUpOneLevel      0      -   347K  -
system/usr/local/bacula@2013.07.22:10:03                     0      -  7.50T  -
system/usr/local/bacula@AfterInitialSend                     0      -  7.50T  -
system/usr/local/bacula@2013.07.25:08:20                     0      -  7.51T  -
system/usr/local/bacula@BeforeMovingKrakenUpOneLevel         0      -  7.51T  -

I will look at merging those snapshots later.

For what it’s worth, this is not the actual layout. I will be using the system/usr/local/bacula filesystem within a jail. That’s where bacula-sd will run. Why? I like to keep major services within a jail. It makes it easier to move the service from one system to another, at least, in theory it does; I’ve not had to use this strategy yet. But I’m sure I will need to one day.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top