[zfs-discuss] Deletion of file from ZFS Disk and Snapshots

Simon Breden sbreden at gmail.com
Tue May 13 07:15:33 PDT 2008


OK, I understand.

I don't think it's possible though, as snapshots are read only, as far as I know.
If you like voodoo you could try going into the .zfs directory, then into the snapshot directory and see what you can do there, but I wouldn't try it, as it might be possible to do harm that way.

Instead, perhaps you could:

1. do a full backup from the initial snapshot, then do incremental backups from the subsequent snapshots, if they are any. This should give you a file system containing all of the files in the current snapshots. 

2. Then you could delete the file you want to remove, but this will cause some snapshots to take ownership of this deleted file.

Here is an example of how to make a backup of all the data from the snapshots to a new file system. Once done, you can see about deleting the file:

zfs send pool/fs at 1 | zfs recv pool/newfs  (full initial backup)
zfs send -i pool/fs at 1 pool/fs at 2 | zfs recv -F pool/newfs (inc. backup between snaps 1 and 2)
zfs send -i pool/fs at 2 pool/fs at 3 | zfs recv -F pool/newfs (inc. backup between snaps 2 and 3)
zfs send -i pool/fs at 3 pool/fs at 4 | zfs recv -F pool/newfs (inc. backup between snaps 3 and 4)
etc for each snapshot until you have done all the snapshots

rm /pool/newfs/file_you_want_to_delete

I think there's probably a quicker way using a snapshot range, but I didn't try that yet.

I actually wrote up some stuff on snapshots and full & incremental backups yesterday. |f it's useful for you, I don't know :)

See: 
http://breden.org.uk/2008/05/12/home-fileserver-zfs-snapshots/
http://breden.org.uk/2008/05/12/home-fileserver-backups-from-zfs-snapshots/

Good luck, and let us know if you manage to make it work.
 
 
This message posted from opensolaris.org



More information about the zfs-discuss mailing list