12 May, 2010

How to Mount Your Partitions Permanently in Ubuntu

                                    Linux machines are very much aware in the case of security, but this extra security may sometimes become a headache for simple linux users. For example, if u have separate partitions or hard drives (for your backup, music collection or photo collection), every time you boot up, you have to mount those when required, providing a password which is sometimes very much irritating. The time-saving solution is to mount such media permanently. There are two steps in this process. Firstly to tell Ubuntu where to find the mount and where you want it mounted. Secondly, to create the folder within Ubuntu's recognised file structure to house the mounted media. After you perform this configuration, your backup folder on a secondary disk can be accessed from within your /home/username folder.

Tell Ubuntu Mount & Local Associated Folder Locations 
Open the fstab file that controls your mounts:-
 
sudo gedit /etc/fstab

Find out the name of partition that you are planning to mount  by issueing the following command. It lists recognized partition tables

sudo fdisk -l 

At the bottom of the file, for each partition or drive you wish to mount forever, paste:-
 
/dev/sdb1 /mnt/mydrives 
ext3  users,noatime,auto,rw, nodev,exec,nosuid 0 0

Read man page of mount for more details
 
• /dev/sdb1 - media to mount
• /mnt/mydrives - 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
• rw - read write access
• nodev - prevents unauthorized device mounts
• exec - execute programmes from disk
• nosuid - do not allow set-user-identifier
• 0 - dunno, probably should though
• 0 - ditto
 
Save the file when you’re done. Check out the figure if you have doubts

 

 
Create the Local Folder to House Mounted Media

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

sudo mkdir /mnt/mydrives

Reboot your system to see the Ubuntu automatically mounting the device @ boot time... In Nautilus look for /mnt/mydrives. You can create a launcher for easier access if needed.
 
Symbolic Link to Permanent Mounted Partition

Here's an optional third step for simplifying the navigation. 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 that symlink to  jump  to the contents of the mounted partition. If you delete a file from a symlink in your /home/username folder, you really really do delete the original file.


3 comments:

spec said...

i will definitely try.

spec said...

yeah i tried

for mounting ntfs drives
type in fstab

/dev/sdaxntfs-3g users,noatime,auto,rw, nodev,exec,nosuid 0 0

Anup Shaji on Saturday, September 11, 2010 said...

Nice one dude....!....its very helpful..
nice work...
keep going....
regards!

Post a Comment

speak out... itz your time !!!

 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger