2

I want to have external USB hard drives automatically mounted when plugged in. I have 2 drives exactly the same except for volume label. They both have the same UUID. I want to be easily able to swap them as I'm using them for backups and want to keep 1 at home for off site backup. I've set up the /etc/fstab so they should mount at different places based on their volume label:

/etc/fstab:

LABEL=Passport1 /media/Passport1 ntfs defaults,windows_names,locale=en_US.utf8 0 0
LABEL=Passport2 /media/Passport2 ntfs defaults,windows_names,locale=en_US.utf8 0 0

blkid shows:

/dev/sdc1: LABEL="Passport2" UUID="4E1AEA7B1AEA6007" TYPE="ntfs"  
/dev/sdd1: LABEL="Passport1" UUID="4E1AEA7B1AEA6007" TYPE="ntfs"

The drives are USB3 but the hub is only USB2.

They both mount automatically during reboot but do not mount when just plugged in to a running system. I've read lots of stuff about this, much of it is old so I'm not sure if it applies. I've read some stuff that says the mounts should happen automatically when plugged in, and lots of other stuff that says you have to install other software to make this happen, although much of it just seems to set up the fstab.

What's the real story?

Here is /var/log/syslog when drive is plugged in:

Dec 14 11:22:58 ausyvutims1 kernel: [66221.300196] usb 1-1: new high-speed USB device number 6 using ehci_hcd
Dec 14 11:22:58 ausyvutims1 mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-1"
Dec 14 11:22:58 ausyvutims1 mtp-probe: bus: 1, device: 6 was not an MTP device
Dec 14 11:22:58 ausyvutims1 kernel: [66221.656020] scsi7 : usb-storage 1-1:1.0
Dec 14 11:22:59 ausyvutims1 kernel: [66222.661534] scsi 7:0:0:0: Direct-Access     WD       My Passport 0748 1016 PQ: 0 ANSI: 6
Dec 14 11:22:59 ausyvutims1 kernel: [66222.666466] scsi 7:0:0:1: Enclosure         WD       SES Device       1016 PQ: 0 ANSI: 6
Dec 14 11:22:59 ausyvutims1 kernel: [66222.667739] sd 7:0:0:0: Attached scsi generic sg3 type 0
Dec 14 11:22:59 ausyvutims1 kernel: [66222.667913] ses 7:0:0:1: Attached Enclosure device
Dec 14 11:22:59 ausyvutims1 kernel: [66222.668047] ses 7:0:0:1: Attached scsi generic sg4 type 13
Dec 14 11:22:59 ausyvutims1 kernel: [66222.678473] sd 7:0:0:0: [sdc] 1953458176 512-byte logical blocks: (1.00 TB/931 GiB)
Dec 14 11:22:59 ausyvutims1 kernel: [66222.687700] sd 7:0:0:0: [sdc] Write Protect is off
Dec 14 11:22:59 ausyvutims1 kernel: [66222.687705] sd 7:0:0:0: [sdc] Mode Sense: 47 00 10 08
Dec 14 11:22:59 ausyvutims1 kernel: [66222.701076] sd 7:0:0:0: [sdc] No Caching mode page present
Dec 14 11:22:59 ausyvutims1 kernel: [66222.701081] sd 7:0:0:0: [sdc] Assuming drive cache: write through
Dec 14 11:22:59 ausyvutims1 kernel: [66222.738062] sd 7:0:0:0: [sdc] No Caching mode page present
Dec 14 11:22:59 ausyvutims1 kernel: [66222.738068] sd 7:0:0:0: [sdc] Assuming drive cache: write through
Dec 14 11:22:59 ausyvutims1 kernel: [66222.754558]  sdc: sdc1
Dec 14 11:22:59 ausyvutims1 kernel: [66222.792006] sd 7:0:0:0: [sdc] No Caching mode page present
Dec 14 11:22:59 ausyvutims1 kernel: [66222.792012] sd 7:0:0:0: [sdc] Assuming drive cache: write through
Dec 14 11:22:59 ausyvutims1 kernel: [66222.792016] sd 7:0:0:0: [sdc] Attached SCSI disk
Dec 14 11:22:59 ausyvutims1 ata_id[16971]: HDIO_GET_IDENTITY failed for '/dev/sdc': Invalid argument

lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 05e3:0702 Genesys Logic, Inc. USB 2.0 IDE Adapter [GL811E]
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
3
  • Is there any particular reason you are using the same UUID? Dec 14, 2012 at 5:54
  • You can also try this tutorial and see if it works the way it is laid out there Dec 14, 2012 at 6:05
  • Hi Christopher, according to the fstab man page, you can use either UUID or LABEL to differentiate drives. I chose LABEL as that is easier to see when I connect a USB drive to Windows PC. I'll try using udev when I go to work on Thursday, but I'm a little concerned about the comment that this shouldn't be used on a mission critical server... (or maybe I misunderstand as Peter Kovacs english is perhaps not great). Thanks for the suggestion.
    – Chris Good
    Dec 17, 2012 at 0:54

2 Answers 2

2

I have found that nautilus will automatically mount the drives if you click on them, otherwise, say for a server where no-one may be using nautilus, or you want the external USB drive to be automatically mounted when plugged in, you can use udev to do this.

0

Making changes to the fstab file is essential since this file controls how Linux provides access to disk partitions and removable media devices.
In the terminal, you can access the man page on mounting devices for more info on mounting devices and how to manipulate the mount process. one way to set auto mount is as follows example: mount -a /dev/sda7 mount -auto /dev/sda7

mount -h will list help on mounting devices

Also when Linux mounts a filesystem it usually records this in the /etc/mtab which has a format similar to the /etc/fstab could also issue the remount command. I hope that this was of some help to you

1
  • Hi Blindfett, thanks for trying but you having told me anything I don't know.
    – Chris Good
    Dec 17, 2012 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .