What are the approaches to finding what external USB disks are currently connected? I''m starting on backup scripts, and I need to check which volumes are present before I figure out what to back up to them. I suppose I could just try all the ones that I know about and see which are there (the list is small enough this is actually feasible), but it''s inelegant. (On Solaris "Nevada", currently build 76 I think). The external USB backup disks in question have ZFS filesystems on them, which may make a difference in finding them perhaps? I''ve glanced at Tim Foster''s autobackup and related scripts, and they''re all about being triggered by the plug connection being made; which is not what I need. I don''t actually want to start the big backup when I plug in (or power on) the drive in the evening, it''s supposed to wait until late (to avoid competition with users). (His autosnapshot script may be just what I need for that part, though.) -- David Dyer-Bennet, dd-b at dd-b.net; http://dd-b.net/ Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/ Photos: http://dd-b.net/photography/gallery/ Dragaera: http://dragaera.info
You may want to peek here first. Tim has some scripts already and if not exactly what you want, I am sure it could be reverse engineered. http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people Eric This message posted from opensolaris.org
Eric Haycraft wrote:> You may want to peek here first. Tim has some scripts already and if not exactly what you want, I am sure it could be reverse engineered. > > http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people > >Thanks, but I already read those, and referred to those in my recent posts, and described in some detail why they''re not terribly useful to what I''m trying to do with my backup schedule (briefly, I want *scheduled* backups that adjust their behavior somewhat based on what external disks are available; Tim''s scripts are very cleverly set up to trigger suitable backups when an external device is connected, which as he says is particularly suitable for laptops). -- David Dyer-Bennet, dd-b at dd-b.net; http://dd-b.net/ Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/ Photos: http://dd-b.net/photography/gallery/ Dragaera: http://dragaera.info
On Wed, 2007-12-12 at 21:35 -0600, David Dyer-Bennet wrote:> What are the approaches to finding what external USB disks are currently > connected?Would "rmformat -l" or "eject -l" fit the bill ?> The external USB backup disks in question have ZFS filesystems on them, > which may make a difference in finding them perhaps?Nice. I dug around a bit with this a while back, and I''m not sure hal & friends are doing the right thing with zpools on removable devices just yet. I''d expect that we''d have a "zpool import" triggered on a device being plugged, analogous to the way we have pcfs disks automatically mounted by the system. Indeed there''s /usr/lib/hal/hal-storage-zpool-export /usr/lib/hal/hal-storage-zpool-import and /etc/hal/fdi/policy/10osvendor/20-zfs-methods.fdi but I haven''t seen them actually doing anything useful when I insert a disk with a pool on it. Does anyone know whether these should be working now ? I''m not a hal expert...> I''ve glanced at Tim Foster''s autobackup and related scripts, and they''re > all about being triggered by the plug connection being made; which is > not what I need.Yep, fair enough.> I don''t actually want to start the big backup when I > plug in (or power on) the drive in the evening, it''s supposed to wait > until late (to avoid competition with users). (His autosnapshot script > may be just what I need for that part, though.)The zfs-auto-snapshot service can perform a backup using a command set in the "zfs/backup-save-cmd" property. Setting that be a script that automagically selects a USB device (from a known list, or one with free space?) and points the stream at a relevant "zfs recv" command to the pool provided by your backup device might be just what you''re after. Perhaps this is a project for the Christmas holidays :-) cheers, tim -- Tim Foster, Sun Microsystems Inc, Solaris Engineering Ops http://blogs.sun.com/timf
dd-b at dd-b.net said:> What are the approaches to finding what external USB disks are currently > connected? I''m starting on backup scripts, and I need to check which > volumes are present before I figure out what to back up to them. I > . . .In addition to what others have suggested so far, "cfgadm -l" lists usb- and firewire-connected drives (even those plugged-in but not mounted). So scripts can check that way as well. Regards, Marion