[ubuntu-nz] How to mount USB drive when no-one is logged in?
Al Twohill
moebiusproject at gmail.com
Thu May 1 06:21:11 BST 2008
On Thu, May 1, 2008 at 4:56 PM, Johann Schoonees <j.schoonees at irl.cri.nz> wrote:
> Sorry M. Archive, this message header is probably garbled from my
> replying to the digest.
>
> Bruce Kingsbury wrote:
> > > With ubuntu, all I need to do is *not* put anything in fstab, detect
> > > whether a drive a connected with `fdisk -l /dev/sdb', and mount it (if
> > > not already) in a fixed place like /media/backup_drive.
> > >
> > > Isn't fdisk a slightly scary/overkill tool to use for simply listing
> > > connected USB devices?
> >
> > fdisk isn't really the tool I would use anyhow.. dmesg will tell you how the
> > device was detected. It won't always be /dev/sdb, it might be /dev/sdc or
> > /dev/sdd next time.
>
> How would you automate that in an unattended script? I imagine grepping
> dmesg (or /var/log/messages) would return entries for drives already
> disconnected some time ago?
>
Each device plugged into ubuntu gets given a uuid for exactly that
reason. You may notice that in ubuntu installs, the /dev/sdxx is
commented, with the uuid in the actual line...
You can see the uuid's of plugged in disks by running
ls -l /dev/disk/by-uuid
Hope that helps
> > > Now, what happens if I also left my memory stick plugged in? In that
> > > case fdisk will print entries for /dev/sdb1, /dev/sdb2, etc. Then I
> > > could use something like e2label to find my back-up drive's label, no?
> >
> > No. /dev/sdb is the whole device/drive, /dev/sdb1 is the first partition on
> > that device, etc. The next device you plug in will most likely be called
> > /dev/sdc (and if it's aprtitioned, those will be /dev/sdc1, etc)
>
> Yes of course, had a late night.
>
>
> Johann
>
>
> --
> ubuntu-nz mailing list
> ubuntu-nz at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-nz
>
--
The project has begun...
More information about the ubuntu-nz
mailing list