Tag Archives: partition

Auto mount partition in ubuntu

I have a dual boot system consisting of 3 partitions – one for windows, one for ubuntu and a bulky MEDIA drive that I share with both of them as it contains all my media files like Music and Videos.

The easiest way to mount a partition automatically to a destination is by editing the fstab.

Open the terminal and determine the device to be mounted.
You need to be root in order to see the disk list

amit@texens:~$ sudo su
[sudo] password for amit:

Use fdisk -l to determine the disk

root@texens:/home/amit# fdisk -l

You’ll get something like this

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x54e308d9

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 6528 52326400 7 HPFS/NTFS
/dev/sda3 6529 33523 216837337+ 5 Extended
/dev/sda4 33524 38913 43295175 83 Linux
/dev/sda5 6529 33274 214837213+ 7 HPFS/NTFS
/dev/sda6 33275 33523 2000061 82 Linux swap / Solaris

Note, the line

/dev/sda5 6529 33274 214837213+ 7 HPFS/NTFS

/dev/sda5 is the partition that we want to mount. Make a note of it.

Now we’ll edit the fstab file located at /etc/fstab.
Again you need to be root in order to edit the fstab file.
Make sure you are the root and use an editor of your choice to edit the file. I’ll be using vi editor for the same.

root@texens:/home/amit# vi /etc/fstab

The fstab file looks something like this.

# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
proc /proc proc defaults 0 0
# / was on /dev/sda4 during installation
UUID=1e6770f3-7cd7-4be9-b6f0-3c30f96f852f / ext3 relatime,errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=232230d0-236c-4e62-9c05-99b61d48b23e none swap sw 0 0

Now, all we need to do is to add the
I want to mount the partition to the location /media/bulk
Create the folder /media/bulk

root@texens:/home/amit# mkdir /media/bulk

Now, add the following line to the end of the file.

/dev/sda5 /media/bulk ntfs-3g defaults,locale=en_US.utf8 0 0

And save this file.
Now, hit the mount command to mount it just this time.

root@texens:/home/amit# mount -a

Next time when you boot into your computer, it will be automatically mounted at its designated position.


Data Recovery from a partition

Ever formatter a partition by mistake, and ended up losing all your essential data? Realized that it was pretty stupid not to backup your favorite pictures, data from your seniors project and about a 100 other scenarios.

I came across a similar situation a week back, what was worse that i lost all my pictures about 20 GB. I had no backup of about 10 GB of them… I had formatter a 200 GB partition while playing with the partition manager.

I tried a couple of softwares including Get Data Back, Recover My Files etc. But none of them helped much. They were unable to build the exact directory structure of my partition. What complicated the matters was the fact that the data to be recovered was very huge in size. We’re talking about a partition of about 200 GB.

I came across a utility known as PhotoRec, it was easy to use and in less that 8 hours, it was able to recover most of the data. But it renamed all the files and the directory structure was lost. When you’re dealing with pictures, its not much of a problem as you can use the properties of a picture to know the creation date etc. Using a script, one can regroup them and place them into the directories accordingly. But this becomes a huge problem when you’re dealing with text files…. and alot of them. All the files from my ongoing seniors project were lost – most of them being C files. I was in total chaos until I found out EASEUS Data Recovery Professional, I used this software to recover all the data. What really impressed me was the fact that the directory structure was preserved with cent percent accuracy. I got all my project files back. It has a demo wizard available for free. But the professional one comes at a price. But the price is nothing when your seniors project is at stake.


* The moment you realize that you formatted a partition by mistake, stop writing on that disk. If it is an external partition, DO NOT MOUNT that partition.

* It is always advisable to make an image of the formatted partition so that in case somethings goes wrong while the data recovery process, you can always be assured that you have a backup. Most of the data recovery programs use a read only permission on the partition, but still it is advisable to have a backup to be on the safer side.

And last, Learn from other people’s mistakes… always always always backup your essential data…!