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>

e.g.

   #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>

e.g.

   #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>

e.g.
  
   #mount 10.10.10.1:/nfs_share /mnt



How to mount SAMBA share :

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

e.g.

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



How to mount ISO file :

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

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


_Enjoy :)

Comments

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?