Disable auto-mount for specific USB partition

Discussion in 'Other Operating Systems' started by CaveDog, Dec 24, 2009.

  1. CaveDog

    CaveDog Member

    Joined:
    Aug 16, 2001
    Messages:
    527
    Location:
    3131.melbourne.vic.au
    Hey guys, I have a 500GB external disk that I use. Its LUKS encrypted, and I have created a 32MB partition at the start which contains FreeOTFE. This way I can whack it into a windows box, and mount the encrypted drive.

    Annoying thing is, when I plug the drive into my ubuntu (Karmic) laptop, It auto mounts both the 32MB partition and the encrypted 500GB partition.

    How can I disable the auto-mount of the 32MB partition?

    Cheers,
     
  2. phreeky82

    phreeky82 Member

    Joined:
    Dec 10, 2002
    Messages:
    9,479
    Location:
    Townsville
  3. .:front2back:.

    .:front2back:. Member

    Joined:
    Aug 30, 2004
    Messages:
    405
    Location:
    G-Town - 3216
    edit your /etc/fstab so it only mounts the needed partition. :)

    usually a shell terminal with

    Code:
    abiword /etc/fstab
    
    will open your fstab in abiword and you can edit lines add lines then save and next time you boot in and plug in the drive it will only mount the partition that you want. ;)
     
  4. cleary

    cleary Mental in the Face

    Joined:
    Apr 25, 2003
    Messages:
    4,243
    Location:
    Griffith NSW
    Yep, you need to identify the partitions UUID, add that to your fstab and set the options for it so it doesn't auto mount (that's not to say gnome will continue to do it's own thing, but it's the first step):

    plug your usb stick in, run dmesg and near the bottom it will give you the device node:
    Code:
    $ dmesg
    ...
    [612551.905363] scsi5 : SCSI emulation for USB Mass Storage devices
    [612551.910071] usb-storage: device found at 11
    [612551.910072] usb-storage: waiting for device to settle before scanning
    [612556.914220] usb-storage: device scan complete
    [612556.914616] scsi 5:0:0:0: Direct-Access     SanDisk  U3 Titanium      3.27 PQ: 0 ANSI: 2
    [612556.914884] sd 5:0:0:0: Attached scsi generic sg4 type 0
    [612556.937234] sd 5:0:0:0: [sdd] 4013710 512-byte logical blocks: (2.05 GB/1.91 GiB)
    [612556.937729] sd 5:0:0:0: [sdd] Write Protect is off
    [612556.937731] sd 5:0:0:0: [sdd] Mode Sense: 03 00 00 00
    [612556.937733] sd 5:0:0:0: [sdd] Assuming drive cache: write through
    [612556.939980] sd 5:0:0:0: [sdd] Assuming drive cache: write through
    [612556.939983]  sdd: sdd1
    
    In this case, the device node is sdd, the partition is sdd1 - to get the unique uuid, you need to run:
    Code:
    $ ls -l /dev/disk/by-uuid/
    total 0
    lrwxrwxrwx 1 root root 10 2009-12-23 12:20 29b2319b-b381-4355-91dc-3f4c4975ed43 -> ../../sda6
    lrwxrwxrwx 1 root root 10 2009-12-30 14:29 6001-B778 -> ../../sdd1
    lrwxrwxrwx 1 root root 10 2009-12-23 12:20 605fc0c0-3ca4-47df-a8b5-e5730c14ebc7 -> ../../sda5
    lrwxrwxrwx 1 root root 10 2009-12-23 12:20 a33526e1-8094-4c1a-8436-144997a5a588 -> ../../sda1
    lrwxrwxrwx 1 root root 10 2009-12-23 12:20 db1e0bff-9a7f-46d0-9b6b-0188538554ad -> ../../sda7
    
    and match up the UUID pointer with the device node for the partition you found in the first step. In my case, it's: 6001-B778

    Edit your fstab (as superuser):
    Code:
    sudo gedit /etc/fstab
    and add the following line:
    Code:
    UUID=<your-uuid> /media/foo <your-fs-type> defaults,noauto    0    2
    
    in my case, the line would look like:
    Code:
    UUID=6001-B778 /media/foo vfat defaults,noauto    0    2
    
    save your changes, unplug it and replug it, and see if it makes a difference.
     

Share This Page

Advertisement: