If you have dual-booted Ubuntu with Windows, your disks that are used by Windows are not mounted (made ready for use) on booting. This is done only when you click on that disk. If you have more than one disk that Ubuntu mounts when you try to access them, it can be a big problem.
Identity-crisis problem: Ubuntu doesn’t assign permanent letters to drives, as done by Windows. Instead, it calls disks as “Disk”, “Disk1”, and so on depending on the order which they were mounted. This means your 90GB music partition can be “Disk1” during one session and “Disk2” in the other if you accessed any other disk first. Now, with the changing names, comes the problem of locating files by various applications such as music players and word processors. A change in disk name will make you reload all the music files in your player or you can close the player. Unmount the drives by going to Places>>Computer and then right-clicking on the drives and unmounting them to remount them in the same order as was the last time when you had loaded those file in your player.
Mount the drives in pre-defined order: Another dumb solution can be to go to the top panel (the bar which contains a all menus), right-click and add “Disk mounter” to the panel. To make it look a bit slicker, you can first add a drawer to the panel and then add the disk mounter to the drawer. Now, as soon as you boot Ubuntu you will have to mount the drives in one defined order so that the addresses of files and folders remain the same all the time.
Automate the process of mounting drives: In order to get rid of this mundane chore, we will automate the entire process in few simple steps. For this, we need to use command-line through a terminal.
Unlike Windows where you get all the rights, unless you are a restricted user, Ubuntu reserves the full rights for “root”, a user which is automatically created at the time of installation. Root is the user who owns the computer and your user account gets a limited set of privileges that suffice day to day requirements. But whenever you need to make some changes to the system, it is root who does this. If you want to login as root, you won’t be able to do this. Users have to borrow rights from root and execute the functions by giving Ubuntu commands. Whenever you need to execute a command that is the privilege of “root” user, type “sudo”, followed by space and then the command in its correct format.
Unmount all the drives: Before you set to fix the automated mounting of drives, unmount all the removable drives, other than CD/DVD. This can be done by navigating to Places>> Computer and then right-clicking on all mounted drives and select unmount.
Open the terminal: Command-line instructions are executed in Terminal. Go to Applications>> Accessories>> Terminal.
Ubuntu mounts or loads all removable drives, including other hard disks, partitions, CD/DVD and flash drives, in separate spaces by creating temporary folders for each removable media. You can find a folder for each mounted removable media device, in the “media” folder that exists in the root folder.
Since we want to create permanent mounts for our partitions and disk we will also have to create folders for each drive or partition, and mount them in that space.
Identify the drives and partitions: Before we can mount the devices, we need to have their complete identification. Type the following command in the terminal and press enter to output the details of existing drives and partitions. You can alternatively copy (Ctrl+V) and paste the command in terminal, using Ctrl+Shift+V.
Note the details of all the drives or partitions that you want to be mounted at startup. You can identify the devices by the order they are listed–first partition first–the size of the partition and the format of the partition.
Ideally, you should automate mounting of all the storage devices where you have documents and other stuff. In my computer, I have two partitions other than one for Windows and a swap partition and a root partition for Ubuntu. They are called /dev/sda2 and /dev/sda3. I will automate the mounting process of these two storage partitions. I will call the first partition “disk” and the other partition “disk1”. If you have more disks or partitions, continue naming them “disk2”, “disk3”, and so on.
Create folders for mounting drives: Now we will create folders in “media” folder for mounting the drives. I will first create a folder called “disk” and then another called “disk1”. If you have more drives, create folders for all of them. For this, I will execute the following commands one by one.
sudo mkdir /media/disk1
Edit mount table: After creating space for mounting the drives, we need to tell Ubuntu what drives have to be mounted at startup. Type the following command and press enter.
Fstab file that contains details of drives to be mounted will open up. Add the details of the drives that you want to be mounted at startup. Use the following format for adding the drives.
Name of the drive — /dev/sda2
Location of mount — /media/disk
Format of disk — ntfs [or fat32 or whatever the list says]
Options — defaults
Dump — 0
Pass — 0
For me, it will be something like this. All values have been separated and put in place under appropriate head by use of Tab key. Use only lowercase for format types such as ntfs and fat32, not NTFS.
/dev/sda3 /media/disk1 ntfs defaults 0 0
Save and close the file as well as the window. With this all your drives are ready to be mounted automatically at startup. The process assigns the rights to mount and unmount these drives to the “root” user. So you will need to use commands to mount or unmount them manually.
Now to mount the drives without having to reboot:
PS: This is the third in a series on switching to Ubuntu from Windows, for non-geeks. At the end of the Ubuntu series, you will be a proud owner of a fantastic Linux system.