How to use mount
How to Mount a file system in Linux
In Linux, everything is a file and it all starts from root (/). Mount command is used to attach the file system on the devices to the root of the system.
To mount /dev/hda1 on /newhd, we use the following command
# mount -t ext3 /dev/hda1 /newhd
The above command will mount /dev/hda1 on the directory /newhd as a ext3 file system. Now you can create directories in /newhd directory that will be created in the hard disk hda1.
To check all the mounted partition, use the following command.
# mount -l The output is as follows. [root@localhost]# mount -l /dev/hda3 on / type ext3 (rw,usrquota,grpquota) [] none on /proc type proc (rw) /dev/hda1 on /boot type ext3 (rw) [] none on /dev/pts type devpts (rw,gid=5,mode=620) /dev/tmpMnt on /tmp type ext2 (rw,noexec,nosuid,loop=/dev/loop0)
Sometimes we mount a wrong partition or our mount command goes wrong. To undo this, we can mount the file system from /etc/fstab as follows
mount -a
To mount a file system as read-only, use the following command. This becomes important when you want to do a fsck on a the partition, since mounting it as read only will prevent any changes in the it while the scan is on.
# mount -o remount,ro /newhd
Sometimes it happens that we cannot create a file and it gives errors while creating a file whereas reading the file works just fine. In this scenarios we need to remount the file as read and write, using the following command.
# mount -o remount,rw /newhd
Mounting and unmounting (done by the command umount ) a file system can be useful when the system’s harddisk has got corrupted or you need to scan it to remove bad sectors.
How to mount a file system form remote machine (NFS Share)
# mount remote_server:/home/ /home
This will mount /home drive from remote server to local system, anything written in /home/ on local system will available on remote_server.
No related posts.
Category: Linux, Software, Technology














How to create ram disk
mount -t tmpfs -o size=256M tmpfs /mnt
df -h /mnt
Filesystem Size Used Avail Use% Mounted on
tmpfs 256M 0 256M 0% /mnt
Say you want to create 100 Mb size ram disk
mount -t tmpfs -o size=100M tmpfs /mnt
df -h /mnt
Filesystem Size Used Avail Use% Mounted on
tmpfs 100M 0 100M 0% /mnt
Superb blog post, I have book marked this internet site so ideally I’ll see much more on this subject in the foreseeable future!