10.4 Mount



You can read and write the hard disk by partitioning it and creating a file system and then mount it. If you mount removable media such as CD-ROM and DVD-ROM, you will be able to read it.

10.4.1 Mount Point

When using a hard disk, CD-ROM, etc., it is necessary to mount in the existing directory, and the directory used for mounting is called a mount point.

The file system used as / is mounted on / and the all file system to be used can be used only after mounting it in some directory.

10.4.2 mount command

Use the mount command to mount the hard disk, removable media, etc. on the mount point.

Format

mount -t type -o options Device_file Mount_point


Mount the hard disk or removable media.


Options

-t type
ext3 for EXT3 file system , msdos for Windows , iso9660 for CD and DVD, etc.

-o options
rw for Reading, ro for read only, etc

Device_file
Device file for accessing the file system

Mount_point
Directory point to mount on


10.4.3 umount command

If you no longer use the mounted hard disk or removable media, unmount it. Use the umount command to unmount.

Format

umount Mount_point


Unmount the hard disk or removable media.


Practice : Mount a hard disk partition


Mount the sdc2 (the second partition of the third drive) to the /opt directory with the mount command.

The rw option was specified so that the file system can read and write.

You can check whether it is mounted by ls command or df command.

Unmount the file system mounted on / opt with the umount command.


# mount -t ext3 -o rw /dev/sdc3 /opt ↵ Mount /dev/sdc3 to / opt directory in ext3 format
# df ↵ List of mounted file systems
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 4567236 3444596 886888 80% /
tmpfs 517660 0 517660 0% /dev/shm
/dev/sdc2 553408 16840 508456 4% /opt
# ls /opt ↵ List mounted /opt directories
lost+found
# umount /opt ↵ Unmount /opt (/dev/sdc3)
# df ↵ List of mounted file systems
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 4567236 3444596 886888 80% /
tmpfs 517660 0 517660 0% /dev/shm
# ls /opt ↵ List the /opt directory
#



Previous Next