Mounting disks automatically

By default, Ubuntu detects any disks (partitions) that it finds; however, such disks are not automatically mounted when Ubuntu boots up and so are not available for use without manually mounting them. This is one of the reasons why my previously-noted bash script checks that both the source and target disks for my real-time backup procedure are both mounted. The other reason is that the script was borrowed from a laptop computer where the target disk is a USB memory stick that isn’t always plugged in when the machine is in use and so a check on its availability is necessary.

However, on the current system, both “DataDisk” and “BarracudaData” are internal hard drives and hence are nominally always available on boot-up. So, the question is can we make life simpler by having these disks mounted automatically? Well, this is Linux, and so almost everything is possible. It’s just a question of knowing how.

The answer is actually very simple. We just need to add a couple of specifications to the File System Table (the file /etc/fstab) to tell Ubuntu that the two disks are to be mounted, and to provide the mount points and disk formatting information.

To edit the file, we need to invoke a file editor (gedit) using the sudo command:

sudo gedit /etc/fstab

Now, we simply add the following two lines to the end of the file:

/dev/sda3 /media/DataDisk/ ntfs-3g defaults,user,
locale=en_US.utf8 0 0
/dev/sdb1 /media/BarracudaData/ ntfs-3g defaults,user,
locale=en_US.utf8 0 0

Note that you need to know the disk location in the Linux filesystem. In my case, DataDisk (/dev/sda3) is the third partition on the first hard disk in my system. The first partition (sda1) is the main Windows drive (c:\), while the second partition (sda2) is a hidden (to Windows) recovery partition installed by the computer manufacturer. Similarly, BarracudaData (/dev/sdb1) is the first partition on the second hard drive. Both disks are formatted as NTFS, hence the use of the ntfs-3g driver.

You can find information relating to the disks installed on your
system by using the command:

sudo fdisk -l

or by running the excellent Boot Info Script
(http://bootinfoscript.sourceforge.net/)

Having made the changes to etc/fstab, re-booting the system now provides direct access to the two NTFS disks. This means that we can simplify the script file used to start inosync since we no longer have to check that the two disks are mounted. However, I have another little trick up my sleeve that means we won’t need to use the initializing script file at all. More on this later.

References:

Mounting Windows Partitions in Ubuntu
http://www.psychocats.net/ubuntu/mountwindowsfstab

Mounting Windows Partitions
https://help.ubuntu.com/community/MountingWindowsPartitions

Advertisements
This entry was posted in Backup, Tweaks. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s