Monday, December 27, 2010

How to deal with "mount" command to mount different devices & partitions.

How to deal with "mount" command when mounting partitions & devices.

Releted files :

       /etc/fstab        - File system table

       /etc/mtab         - Table of mounted file systems

       /etc/mtab~        - Lock file

       /etc/mtab.tmp     - Temporary file

       /etc/filesystems  - A list of filesystem types to try

NOTE : Mounting with "mount" command is a temporary mounting. After you restart your PC you will loose all mounted partition. To Mount any partition permanently use "/etc/fstab" file. I'll post another blog on "/etc/fstab" file.

Basic uses of "mount" command :

1. #mount -h - Display help message to use mount command.

2. #mount -V - Display mount utility version.

3. #mount - Display currently all mounted partitions.

   #mount  -l -t ext3

Note : -l = List all , -t = Filesystem type (ext3, swap, nfs etc.)

Remounting either one partition or all partitions:

   #mount -a - Remount all the partitions from "/etc/fstab" file.

   #mount /dev/cdrom -o remount - Remount cdrom device again, You can use partitions as well with this command.

How to Mount partitions :

1. Mounting "ext3" partition,

   #mount <Device name> <Destination Folder>


   #mount /dev/sda3 /mnt - Will mount "/dev/sda3" device or partition on "/mnt" folder.

   Note : To see the partition device name use "#fdisk -l" command. You can use "ro" Read Only or "rw" Read Write options also if you want.

2. Mounting "Fat32" windows partition,

   #mount -t vfat <Device Name> <Destination Folder>


   #mount -t vfat /dev/sdb /mnt

3. I'll post another blog for mounting NTFS partition :)

How to Mount Floppy drive :

   #mount /dev/fd0 /mnt - "/dev/fd0" is the default device file name for floppy device. But you can change "/mnt" folder.

How to Mount CD/DVD ROM :

   #mount /dev/cdrom /mnt - "/dev/cdrom" is the default device file name for CD/DVD ROM.

How to Mount USB Drives :

Steps :

1. Check the USB file name by using "#fdisk -l" command, as here i am using my 4GB USB which is deted here like,

2. Next, mount it by,

   #mount /dev/sdb /mnt

How to mount NFS share :

   #mount <NFS Server ip>:/<NFS Share name> <Destination Folder>

   #mount /mnt

How to mount SAMBA share :

   #mount -t smbfs -o username=<UserName>,password=<Password> //<Samba Server IP>/<Samba Share> <Destination Folder>


   #mount -t smbfs -o username=ashish,password=ashish123 // /mnt

How to mount ISO file :

   #mount -o loop <ISO Image Name> <Destination Folder>
   #mount -t iso9660 -o ro,loop=/dev/loop0 <ISO Image Name> <Destination Folder>

   #mount -o loop RHEL_5.iso /mnt
   #mount -t iso9660 -o ro,loop=/dev/loop0 RHEL_5.iso /mnt

_Enjoy :)

No comments:

Post a Comment