FreeBSD 9 ZFS on USB disconnected cause ZFS freeze

Hi,

My server is running FreeBSD 9 64bit with ZFS and attached an USB drive for ZFS send/receive backup. The USB drive is formatted to ZFS as well.

However, recently the USB was not detected unexpectedly and it caused all the zfs and zpool commands to freeze forever. The problem might be due to the volume on the USB disk still being mounted.

How can I force-export or unmount the volume on USB drive? zpool export -f volume doesn't work at all and freezes forever.

Unplugging the USB HDD and reattaching it to the USB port doesn't help at all.

Any help will be appreciated.
 
belon_cfy said:
However, recently the USB was not detected unexpectedly and it cause all the zfs and zpool commands freeze forever. The problem might be due to the volume on USB disk is still mounted.
Yeah, that's still a bit of a problem. Back in the day it would simply panic the whole system when that happens. A lot has improved since. Not really sure how to solve this except making sure the USB drive (and USB ports) work correctly.

FreeBSD really doesn't like it when a mounted filesystem suddenly disappears.
 
Use UFS for USB (if it fits your purpose) and something like zfs send [your options] [snapshot]| gzip - > /mnt/usb/snapshot.zfs.gz .
 
Please don't do that. There's no redundancy at all in the stream sent by zfs send. If there's even one bit flip for whatever reason the whole stream in resulting file that you save may be completely trashed and can not be restored anymore. zfs receive will tell you if it can't use the stream but it's better that it tells it to you when doing the backup, not when you're trying to restore your system from the only backup available.
 
HarryE said:
Use UFS for USB (if it fits your purpose) and something like zfs send [your options] [snapshot]| gzip - > /mnt/usb/snapshot.zfs.gz .

I prefer ZFS filesystem on both USB and local HDD. Piping the output to a file will lose the incremental backup capability.

I will try to stay away from UFS, EXT4, NTFS because it will potentially corrupt your data and you will never know.
 
If it's for long term back-up, you may check your saved backups with zcat /mnt/usb/snapshot.zfs.gz | zfs receive -n some_zfs. The incremental back-up/restore is possible in the same way. Another option is to transfer the stream through network onto another ZFS (no server lock-up). Or use an external eSATA drive instead of USB.
 
At this moment I am working on fixing several issues to allow a pool to continue operating if a USB stick is reconnected back. It won't help if the stick is gone forever, I don't know a way to forcefully unmount in that case, but at least it's something.
 
mav@ said:
At this moment I am working on fixing several issues to allow a pool to continue operating if a USB stick is reconnected back. It won't help if the stick is gone forever, I don't know a way to forcefully unmount in that case, but at least it's something.

Good news for us, as least it is some kind of workaround to deal with such an issue.
 
I've committed several related changes to FreeBSD HEAD. Now zpool clear should be able to restore pool operation after a device reconnect. I'll merge it to 9-STABLE in few weeks after the release of 9.2.
 
Back
Top