简体   繁体   中英

Mount ZFS dump from a file in Linux

I have a NAS that does regular snapshots. I was toying around with the snapshots, planning to eventually store them in the cloud.

I create a file from a snapshot using zfs send and redirecting the output:

zfs send snapshot_name > backup.snapshot

If I want to inspect the snapshot, is there a way to mount the snapshot file itself?

Thanks

Mirko

ZFS doesn't support that. If you really want to validate a snapshot, I recommend that you create another ZFS pool in a different host and/or a virtual machine to issue a zfs send and zfs receive .

For example, consider this setup:

  • A production ZFS pool ( tank ) running on a host;
  • A virtual machine with another ZFS pool ( tank-backup ) that acts as a snapshot validation point;
  • root SSH access is permitted using SSH key pair authentication.

On the production ZFS pool, if a snapshot is created (eg snap1 ), you can transfer it to the virtual machine in order to validate it. Also, by doing that, you will end up with a backup of this snapshot.

On the machine running the production ZFS pool, do the following:

  • sudo zfs send tank@snap1 | ssh root@zfs-backup-vm zfs receive tank-backup

Additionally, if you want to work with incremental snapshots (eg: you created the snap2 snapshot and want to transfer it to the virtual machine):

  • sudo zfs send -I tank@snap1 tank@snap2 | ssh root@zfs-backup-vm zfs receive tank-backup

About seeing the contents of ZFS snapshots, you can issue this command:

  • zpool set listsnapshots=off tank [1]

This will enable the property listsnapshots . Considering that the ZFS pool tank is mounted at /tank and you have a ZFS dataset called home , all the snapshots for this ZFS pool and dataset will be accesible from this path:

  • /tank/home/.zfs/snapshot

[1] https://docs.oracle.com/cd/E19253-01/819-5461/gbiqe/index.html

The following procedure works for me:

# zfs send tank/test@0830 > /bkups/test.0830
# zfs receive tank/test2@today < /bkups/test.0830
# zfs rename tank/test tank/test.old
# zfs rename tank/test2 tank/test

Of course, you can also access the tank/test2 dataset directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM