Stop Having to Mount Partitions Manually



ubuntu karmic koala

Here's how to stop password requests every time you need to mount media. Automate access of any media: partitions, internal/external drives, etc.

One problem with having separate partitions or hard drives – for example for your backup, music collection or website development – is that, every time you boot up, you have to mount those when required, providing a password.

The time-saving solution is to mount such media permanently.

Setup Unmanaged VPS (4 Noobs!) ... with vpsBible
Secure WordPress. Properly. ... with wpCop, the platform's dedicated security website
Olly 'the_guv' Connelly's vpsBible.com site and 'WordPress 3 Ultimate Security' book.

There are two steps in this process. Firstly to tell Karmic Koala where to find the mount, externally of the system's automatically recognised partitions, and where you want that mounted. Secondly, to create the folder within Koala's recognised file structure to house the mounted media. When setup, for example, your backup folder on a secondary disk can be accessed from within your /home/username folder. Handy, huh?

Tell Karmic Mount & Local Associated Folder Locations

Open the file that controls your mounts:-

At the bottom of the file, for each partition or drive you wish to mount for ever, paste:-

  • /dev/sdb1 – media to mount
  • /mnt/backupBox – location to mount to with a friendly name
  • ext3 – filesystem
  • users – allow all users, alternatively use user
  • noatime – don't waste resources recording last access time or, if you want this info, change to atime
  • auto – mount on boot, alternatively noauto allows you to mount when needed
  • rw – read write access, alternatively ro would be read only
  • nodev – prevents unauthorized device mounts
  • exec – execute programmes from disk, alternatively noexec prohibits this
  • nosuid – do not allow set-user-identifier
  • 0 – dunno, probably should, someone clue me in please
  • 0 – ditto

.. read man mount for more details or Google it.

Save the file.

Create the Local Folder to House Mounted Media

Now create the folder location for the mount so, in this example:-

Reboot.

In Nautilus, look for /mnt/backupBox. You can create a launcher for easier access if needed.

Two Handy Commands when Planning Media to Mount

  • df -h report file system disk space usage
  • sudo fdisk -l list recognized partition tables

Symbolic Link to Permanent Mounted Partition

Here's an optional third step.

Rather than having to navigate each time to your /mnt folder to find your media, you can shortcut to there from, say, your /home/username folder. An easy way to do this is to open nautilus twice, once navigating to your /mnt folder and, with the other, to your /home folder.

Now, holding down the Ctrl and Shift keys, simply drag the newly mounted media file accross to your /home/username folder which you can see in your /home folder. From now on, when you navigate to your /home/username folder, click on the symlink and the contents of the mounted partition are revealed right there, as though they resided directly in your home directory. But beware, this is not like a shortcut in windows; files and folders contained in a symbolically linked destination behave as though they were wherever you have created the link so, say you delete a file from a symlink in your /home/username folder, you really really do delete the original file.

Alternatively, if you prefer to use syntax to create the symbolic link, here's the deal:-

So, for this example:-

.. where the first destination is the folder to link to, and the second the place to add the link, with it's new name, in this case, being ‘backup'.

4


About the Author:

Olly Connelly (yeah, that's me) blogs at guvnr.com, polices WordPress security at wpCop.com and helps noobs build web servers at vpsBible.com, so if you've got sleeping problems you know where to come.

Discussion

  1. the_guv  March 18, 2012

    Good to hear Jerry, tx for the hug 🙂

  2. Jerry  November 7, 2011

    Thank you. I’ve been fighting for days to get my spare HD and USB drive to mount so I could share them.

    Thank You

  3. the_guv  March 16, 2010

    @Seymour .. 6 more weeks and we’ll have Lucid Lynx .. lookin forward to the upgrade 🙂

    but workaround, solution, c’est la vie!

  4. Seymour B Lindman  March 10, 2010

    This is not a solution, it’s a workaround.
    The real solution would be an automount integrated into the Policy Kit. This would allow one click mount unmount as in 9.04, which would automount local drives by default anyway.

    Making it like 9.04 would be a proper solution.

    Frankly Jaunty is better than Karmic.

Add a Comment