Ross
2007-Dec-13 10:17 UTC
[zfs-discuss] Auto backup and auto restore of ZFS via Firewire drive
Hey folks, This may not be the best place to ask this, but I''m so new to Solaris I really don''t know anywhere better. If anybody can suggest a better forum I''m all ears :) I''ve heard of Tim Foster''s autobackup utility, that can automatically backup a ZFS filesystem to a USB drive as it''s connected. What I''d like to know is if there''s a way of doing something similar for a firewire drive? Also, is it possible to run several backups at once onto that drive? Is there any way I can script a bunch of commands to run as the drive is connected? thanks, Ross This message posted from opensolaris.org
Tim Foster
2007-Dec-13 11:11 UTC
[zfs-discuss] Auto backup and auto restore of ZFS via Firewire drive
Hi there, On Thu, 2007-12-13 at 02:17 -0800, Ross wrote:> This may not be the best place to ask this, but I''m so new to Solaris > I really don''t know anywhere better. If anybody can suggest a better > forum I''m all ears :)You could have just mailed me :-)> I''ve heard of Tim Foster''s autobackup utility, that can automatically > backup a ZFS filesystem to a USB drive as it''s connected. What I''d > like to know is if there''s a way of doing something similar for a > firewire drive?Short answer: no idea, it should just work, but I haven''t tested firewire (oh the irony! [1]) Longer answer: here''s how the software works: 1. When you enable the service, it starts a small python daemon, which monitors the system D-Bus[2] watching for devices to be inserted. The daemon is mostly just boiler-plate code, with the useful stuff near the end. 2. When a device is inserted, the daemon kicks off a shell script, passing it the device name, and the volume id of the device. 3. The shell script consults the SMF service''s properties to see if that volume id is "interesting", if it''s not, it exits. 4. For "interesting" volumes, we wait for the volume to get mounted. Then the shell script either gets the name of the zfs datasets to be backed up from another SMF service property, or looks for datasets on the system that have a given user-property (com.sun:auto-backup) 5. Those datasets then have a snapshot taken of them, and we send those snapshot-streams to the backup volume, saved as flat files, split over 4gb boundaries (pcfs limitations) The question is, does plugging a firewire mass-storage device into the system generate a D-Bus event, and does the device get automatically mounted ? I think it probably should, but I haven''t tried it.> Also, is it possible to run several backups at once onto that drive? > Is there any way I can script a bunch of commands to run as the drive > is connected?If you configure multiple datasets to be backed up, I think that happens in serial at the moment. As for scripting other commands, it''s probably feature-creep to put this into the code, but download the software from: http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people (there''s a README in there that might be useful) have a look at: zfs-auto-backup-0.2/src/usr/lib/zfs-auto-backupd.py zfs-auto-backup-0.2/src/usr/lib/zfs-auto-backup.ksh - the python daemon and shell script respectively. You should be able to see how the daemon invokes the shell script and hack accordingly to run your own scripts too. One additional point - this doesn''t do restore yet: restoring would mean doing some sort of synchronisation between what''s on your system and what''s saved to the backup disk. (you can of course manually restore via "zfs recv") Ideally, everyone would have ZFS on their removable devices, and it''d be a simple case of rsync or somesuch between the two filesystems to do a restore, resolving conflicts where they arise. Likewise, I''d love to be able to browse the backup contents on my removable disk, but since I''m assuming that all removable disks are pcfs for now, I''m only storing flat-files (which no archiver can currently read - the only way of getting at the contents is "zfs recv" to another zfs dataset) Hope this helps? cheers, tim [1] Yeah, I work in zfs-test, and haven''t fully tested my own software - clearly not a *real* tester [2] see hal(5) and http://www.freedesktop.org/wiki/Software/dbus -- Tim Foster, Sun Microsystems Inc, Solaris Engineering Ops http://blogs.sun.com/timf