Page 2 of 2

Re: cannot import pool after export

PostPosted: Tue May 24, 2016 12:14 am
by maybeageek
Brendon wrote:If you believe the output of diskutil list, disk3 appears to be HFS "Intenso1TB", although it is easy to have a disk that looks like that contain ZFS.

Yes, I believe diskutil list, as I reformatted disk 3 (Intenso1TB) to HFS.

Code: Select all
sh-3.2# zpool import -a
no pools available to import


Code: Select all
sh-3.2# zpool status
no pools available


Brendon: If you have any hope for my volume at all then I'd be happy, otherwise I would just start from scratch. The only thing that "hurts" is a virtual machine that was placed there, but I can re-install that server in like 30 minutes. So, the pain isn't that much, but I'd like to get to the ground of what happened.

Regards,
Thomas

Re: cannot import pool after export

PostPosted: Tue May 24, 2016 4:12 am
by Brendon
Hmmm..I see. Well you can't zfs send to an hfs drive. That explains my confusion seeing only a single zfs drive.

As for the pool, unless there is a magician out there it seems unlikely that you will recover it. However it would be worth understanding what happened to it, last thing I want is people believing export kills pools.

- Brendon

Re: cannot import pool after export

PostPosted: Tue May 24, 2016 4:18 am
by maybeageek
Brendon wrote:Hmmm..I see. Well you can't zfs send to an hfs drive. That explains my confusion seeing only a single zfs drive.

As for the pool, unless there is a magician out there it seems unlikely that you will recover it. However it would be worth understanding what happened to it, last thing I want is people believing export kills pools.

- Brendon


yep, I know I cant zfs send to an HFS volume, but I needed it shortly.

I will dd zeros on both of them, recreate the exact steps I took before I exported the volume.

Question: The only thing I did about a week before I exported the volume and deleted the backup drive was to test zfs send | zfs recv a snapshot. After the test was successful I destroyed the receiving file system.

So the only thing I could imagine is somehow that zfs send | recv did something to the source drive as well?
But as I understood it the sending drive should be completely independent from the receiving one! Otherwise sending over SSH would make no sense, right?

Re: cannot import pool after export

PostPosted: Tue May 24, 2016 10:58 am
by maybeageek
Ok, after I started everything from scratch I can create snapshots, send and receive them, export, import pools.
So, everything works as it should. Whatever went wrong I don't know.

For anyone interested, this would be my backup script.
Code: Select all
#!/bin/bash
# ZFS Backup Script to backup one dataset on one disk on another

DATE=`date "+%Y-%m-%dT%H_%M_%S"`
#create a snapshot
zfs snapshot Intenso1TB/VMs@Backup-$DATE
# send it to the other disk
zfs send Intenso1TB/VMs@Backup-$DATE | zfs recv -F Backup1TB/B_VMs
# destroy the snapshot on the source disk
zfs destroy Intenso1TB/VMs@Backup-$DATE

Re: [SOLVED] cannot import pool after export

PostPosted: Tue May 24, 2016 1:57 pm
by Brendon
Thanks for that. To answer your question, sending a snapshot will not harm the source drive.

You could look into znapzend to take care of your backup needs.

- Brendon

Re: [SOLVED] cannot import pool after export

PostPosted: Thu May 26, 2016 4:23 am
by maybeageek
Brendon wrote:Thanks for that. To answer your question, sending a snapshot will not harm the source drive.

You could look into znapzend to take care of your backup needs.

- Brendon


Thanks for your help Brendon.

Znapzend does not work so well on OS X as I discovered?
However, I think I found a way to manage my snapshot needs:
Code: Select all
zfs list -H -t snap -o name -S creation | tail -n +14 | xargs -n 1 zfs destroy -r

With a script that runs hourly on weekdays and another that runs on Sunday, I can easily keep 2 weeks of daily snapshots and 1 month of weekly snapshots and so on.

Re: [SOLVED] cannot import pool after export

PostPosted: Fri May 27, 2016 6:16 pm
by stumble
I've been using this for months, and it works well:

https://github.com/zfsonlinux/zfs-auto-snapshot

I like your idea, though, because it's so simple.

Re: [SOLVED] cannot import pool after export

PostPosted: Tue Jun 28, 2016 8:07 pm
by SmashedGecko
stumble wrote:I've been using this for months, and it works well:

https://github.com/zfsonlinux/zfs-auto-snapshot

I like your idea, though, because it's so simple.


I've had a look at zfs-auto-snapshot but just can't seem to get it to produce any snapshots.
Would you be able to run me through what you did to get it going? or point me to a guide?

Re: [SOLVED] cannot import pool after export

PostPosted: Tue Jun 28, 2016 9:29 pm
by stumble
Ah: I've remembered that some versions of zfs-auto-snap don't work with O3X. Try this one:

http://bunny.xeny.net/temp/zfs-auto-snap

Re: [SOLVED] cannot import pool after export

PostPosted: Wed Jun 29, 2016 1:02 am
by stumble
And then put this sort of thing in your crontab:

Code: Select all
*/5   *   *   *   *   sudo zfs-auto-snap bing/main frequent 12
0   *   *   *   *   sudo zfs-auto-snap bing/main hourly 24
1   9   *   *   *   sudo zfs-auto-snap bing/main daily 31
5   10   1   *   *   sudo zfs-auto-snap bing/main monthly 1000
6   9   *   *   *   sudo zfs-auto-snap bing/occasional daily 31
8   10   1   *   *   sudo zfs-auto-snap bing/occasional monthly 1000
3   10   1   *   *   sudo zfs-auto-snap bing/tamp monthly 1000