[ubuntu-nz] How to mount USB drive when no-one is logged in?

Sid Bachtiar sid.bachtiar at gmail.com
Wed Apr 30 05:36:30 BST 2008


I think there are two ways that I'm aware of ... both using /etc/fstab
(http://ubuntuforums.org/showthread.php?t=283131)
- One is to allow users to use pmount command to mount the drive
- Another is to set the mounting to auto which would mount the drive
automatically when the system boot

I'm a newbie myself so I don't have the details on top of my head.

On Wed, Apr 30, 2008 at 2:29 PM, Johann Schoonees
<j.schoonees at irl.cri.nz> wrote:
> I've googled and searched the archives but I'm getting swamped with
>  marginally related "USB drive does not mount" hits.  Here goes:
>
>  When I log into the kubuntu Feisty desktop, there is an icon showing
>  that my external USB drive is connected and mounted.
>
>  However, cron runs a nightly back-up script for me at 3 am when no-one
>  should be logged in, but after migrating from Fedora to Feisty, it fails
>  at the point where I try to mount the external USB drive:
>
>  MOUNT_OK=no
>  for DISK in $DISK_LABELS
>  do
>  # mount -w "$MOUNT_POINT/$DISK" 2> /dev/null
>  mount -w "$MOUNT_POINT/$DISK"
>  MOUNT_RES=$?
>  if [ "$MOUNT_RES" = "0" ]; then
>  MOUNT_OK=yes
>  break
>  fi
>  done
>
>  results in:
>
>  mount: can't find /media/backup_0 in /etc/fstab or /etc/mtab
>  mount: can't find /media/backup_1 in /etc/fstab or /etc/mtab
>  mount: can't find /media/backup_2 in /etc/fstab or /etc/mtab
>  ...
>
>  even when a disk with label backup_1 (or 2 etc.) is connected.
>
>  There is no entry for /dev/sdb1 in /etc/fstab.  There is one in etc/mtab
>  when someone is logged into the desktop, but not when not.  It looks
>  something like this:
>
>  /dev/sdb1 /media/backup_1 ext3 rw,noexec,nosuid,nodev,sync,data=ordered 0 0
>
>  Under Fedora it used to look like this:
>
>  /dev/sdb1 /media/backup_1 ext3 rw,nosuid,nodev 0 0
>
>  The exact mount point depends on the disk label.  I have more than one
>  back-up disk, each with a unique label.
>
>  Under Fedora there used to be an entry in fstab like this:
>
>  /dev/sdb1 /media/backup_1 ext3 pamconsole,exec,noauto,managed 0 0
>
>  which changed automatically (apparently under control of something
>  called fstab-sync which I don't see in kubuntu) according to the label
>  of the connected drive.
>
>  In short, how should my script detect and mount a connected USB external
>  drive when no-one is logged in?
>
>  Any help appreciated,
>  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