[ubuntu-nz] How to mount USB drive when no-one is logged in?
Sid Bachtiar
sid.bachtiar at gmail.com
Thu May 1 02:15:10 BST 2008
> Under Fedora, I think fstab was automatically updated with newly plugged
> USB devices, by default mounted on /media/<label> or /media/usbdisk if
that sounds bad ... I read that fstab is not supposed to be updated by
any program as it is for statically mounting drive.
The good thing (IMHO) with using fstab is that you don't need to
remember the options. And you can use
"$sudo mount -a" to mount all drives and "$sudo umount -a" to unmount
all drives. The HDD and important devices don't get affected with
these commands in my experience.
I prefer fstab because I plugged USB drives with few partitions
(different format: FAT32, Ext3, etc) on my home server and share it on
internal network. So it is not practical for me to remember all the
options for each drives and partitions.
Good luck
On Thu, May 1, 2008 at 1:05 PM, Johann Schoonees <j.schoonees at irl.cri.nz> wrote:
> I think I'm beginning to see the light. Thanks muchly to those who helped.
>
> I did not understand the jist of mount. It seems one does not have to
> rely on fstab entries to mount a device (at least not if I am root,
> which my back-up cron script will be). Just `mount -ow /dev/sdb1
> /media/backup_drive' (making sure the directory exists) and I'm away.
>
> Haven't had a chance to try this yet. I'll experiment this weekend.
> This is me thinking aloud a bit in the hope that someone will beat me
> round the head with any glaring errors.
>
> Under Fedora, I think fstab was automatically updated with newly plugged
> USB devices, by default mounted on /media/<label> or /media/usbdisk if
> it had no label. That made it necessary for my script to iterate
> through all my known disk labels to find out which one was mounted, if any.
>
> 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?
>
> 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?
>
> Looking through `man -k label' on my Fedora system at work, `devlabel
> add -d /dev/sdb1 -s /root/backup_drive' looks quite neat, but I suppose
> it will want each unique (by UUID) device to be linked with a different
> symlink? Or is there a way for the symlink to stay the same across
> different devices mounted one at a time, which is really what I'm after?
>
> And the day will surely come when I break all the rules and leave *two*
> back-up drives connected. :-> The joy of idiot-proof script writing,
> where the idiot is me...
>
>
>
> Johann
>
> --
> ubuntu-nz mailing list
> ubuntu-nz at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-nz
>
More information about the ubuntu-nz
mailing list