Mounting Devices in Linux
I wrote this article, long time ago for CyberRealm of Sunday Observer and I though of puttin it here because this can still help you. Mounting devices is a common problem among users, how to mount their hard disk partitions as well as their Flash drives on Linux. Well this is not a big task, but unlike in Windows we can’t just plug the device and access it. We have to do a small process called ‘mounting’
Actually there are a large number of Linux distributions and there are some small differences between them. The most popular distribution is Redhat, so I’ll show you how to do these things in Redhat Linux and I’ll use a common ways so you can apply it to other version.
First we’ll look how to mount and unmount our floppy and CDROM. If you enter a CD to the ROM drive in GUI, Linux will do the mounting for you, but if you are in the command line interface you have to do the mounting manually.
By default Linux is mounting your CDROM and floppy onto directories in /mnt/ (/mnt/floopy and /mnt/cdrom) directory (But Fedora Core 3 and RHEL uses a separate directory called /media/).
To mount any thing the command is mount (without the greater than and less than signs) eg :- For the CDROM: - mount /mnt/cdrom and for the floppy: - mount /mnt/floppy.
To unmount something the command is umount. Eg: - umount /mnt/cdrom.
To do additional mounting, you must login as the super user, ‘root’. We can mount these things easily because Linux maintains a file called ‘fstab’ (which is in /etc/ directory) to keep information about the mounted items. This is where the raw mount points and their directories are defined.
Now lets look how to mount your FAT partitions to work on Linux (Redhat by default do not allow to mount NTFS partitions, but some other distributions do. So I’ll discuss about NTFS partitions later.). But first you have to understand how Linux identify hard disk partitions.
Linux uses hd notation for hard disks. For example hda1, ‘a’ tells that it’s the first hard disk (for the second hard disk it uses ‘b’ and so on) and ‘1’ represents the partition number. If you don’t know how your partitions are identified, just type fdisk –lon a terminal. So it’ll display all the HDD information and their formats.
Because we haven’t put any entries to ‘fstab’ we cannot mount our partitions like earlier. We have to specify the raw mount point (raw mount points reside in /dev/ directory, byt they cannot be used directly to read or write) also. First make a folder (which you are going to mount your FAT partition).
The command is
mkdir directory_name.Then you can do the minting.
Ex: - I’m going to mount ‘hda1’ to ‘/mnt/fat’ directory. The syntax for that is
mount /dev/hda1/mnt/fat.
But when you reboot your system the partition will be unmounted, so you have to mount this each time you want to access the partition. To avoid that we can use the /etc/fstab file. Put the following entry in the fstab file.
/dev/hda1 /mnt/fat vfat defaults 0 0
Then mount it using the mount command,
mount /mnt/fat
Mounting your flash drive is simple too like that (but some flash drives do not support linux, make sure your flash work on linux first). Linux identify the flash drive as a SCSI disk, so ‘sd’ notation is used to identify it.Like before create a directory (ex /mnt/flash) first and them mount the flash on to it. If you don’t have any SCSI HDDs flash will be the ‘sha1’. The syntax is mount /dev/sda1/mnt/flash. And you can a put a entry to fstab like earlier.
To mount a NTFS partition you have to do a small kernel patching (in RedHat linux, other versions might not want to do this). You have to download a small patch file from http://linux-ntfs.sourceforge.net/ and you can get more information about mounting NTFS partitions.
First you need to identify what is ur kernel versiona and the processor type. The easyest way is to Press Ctrl+Alt+F1 (press Ctrl + Alt + F7 to come back) . then you’ll get a shell where is says some thing like this (in my machine, your may be different) .
Red Hat Linux Kernel 2.4.20-8 on an i686 login:“2.4.20-8” represent the kernel version “i686” is my processor type (Intel) so you have to download the patch accoding to those and your Linux version. Then install it using the rpm command. rpm –ivh file_name . After installing, make directory and mount it like before.
Eg: - mkdir /mnt/windows
mount /dev/hda1 /mnt/windows -t ntfs –r
Dharshin De Silva
Delicious
Digg
Reddit
Magnoliacom
Newsvine
Furl
Google
Yahoo
Technorati
Icerocket



Post new comment