To mount a disk , there are two necessary conditions
- The disk ( device ) must be one of the files in the /dev directory.
- The disk must be listed in the /etc/fstab ( or /etc/mtab sometimes ) file along with some extra information.
By default when you install Linux, it is automatically configured to be able to access your floppy disks, cdrom and atleast one hard disk.
Also every time you boot into linux, your swap and your root directory , the \'/\' directory are mounted.
However there are times when you have stored some songs on your windows partition and you want to listen to them while running Linux, or maybe read some web-pages you saved on Windows while running Linux. For this you might have to configure your system to read the Windows drives or as we say, mount them.
Mounting is done using the mount command but before using that command we must actually edit the configuration file for it in the /etc folder.
NOTE : Almost all configuration files in Linux are stored in the /etc directory and its subdirectories.
The file to look for now is the /etc/fstab file. Open this file in your favourite text editor.
( If you are using KDE, you can do this by typing \" kwrite /etc/fstab \" in the console. )
What you see now is something similar to this :
/dev/hdc5 / ext2 defaults 1 1
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hdc6 swap swap defaults 0 0
/dev/cdrom mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
The dashes here are replaced by blank spaces in the file The first column lists the device which can be mounted from the /dev directory. The second column lists the mount point or the directory in which this device can be opened once mounted. The third column lists the format in which data is stored on this disk. The fourth column lists some parameters used for mounting the disk. The last two columns are 0 0 unless the disk to be mounted is your \'/\' partition.
Now first we must find which file in /dev denotes our windows hard disk. Generally this is /dev/hda1 if the Windows Hard Disk is your primary master disk. It is /dev/hdc1 if the Windows Hard Disk is your primary slave disk We must now create a mount point , or a directory in which the drive will be opened when mounted. Open the console.
Type :
mkdir /mnt/hda1 (For most users)
OR
mkdir /mnt/hdc1 (For those rare few who have a windows as primary slave disk)
Data on a windows hard disk is stored in fat32 or fat format which is denoted by \'vfat\' in linux. So now lets edit the /etc/fstab file which we have opened in the text editor. Make a new entry which should look like this :
/dev/hda1---- /mnt/hda1---- vfat---- sw---- 0 0
OR
/dev/hdc1---- /mnt/hdc1---- vfat---- sw---- 0 0
so that the above values are in line with the other columns Depending upon whether you have selected /dev/hda1 or /dev/hdc1 ( If you went wrong in this selection, it would not harm your hard disk so if u dont succeed, try using the other one. Try to keep the columns formatted i.e. Perfectly one below the other just as shown abov. Now save the /etc/fstab file.
Open the console and type :
mount /dev/hda1
OR
mount /dev/hdc1
Now do
cd /mnt/hda1
or
cd /mnt/hdc1
then do
ls
This should give you a list of the files in your Windows drive. Now you can create a shortcut to the windows disk on your desktop using
cp -l /mnt/hda1 /home/(user name)/Desktop
And thus you have mounted your Windows drive.
Comments