DEV Community

Bijay Kumar Pun
Bijay Kumar Pun

Posted on

Linux Test Session: Mounting media disk with $mount [unedited]

Disk space statistics is an important thing to know


The linux file system combines all media disks into a single virtual directory.
Which means, if a new media disk is to be used, it should be placed in the virtual directory, which is called mounting.
In newer version of Linux, thijcls mounting process occurs automatically.

The $mount command


The $mount lists media devices currently mounted to the system.

Alt Text

From above image

  • device_filename on /mount_point type filesystem_type (access_status)

So basically, the $mount command provides 4 pieces of information:

  • The device filename of the media
  • The mount point in the virtual directory
  • The filesystem type
  • The access status of the mounted media

/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)

This shows that device file sda2 is mounted on root directory / which has a ext4 file type with access status inside braces.

Mounting a device

$mount -t type device directory
This mounts a given device of given type to the given directory

  • type
    The filesystem type under which the device was formatted
    Eg. vfat for windows, ntfs for later windows, iso9880 for cd-rom filesystem etc

  • device
    the location of the media device

  • directory
    the location in the virtual directory (mount point)

Eg. to manually mount the USB memory stick at device /dev/sbd1 at location /media/disk, the command would be:
*$mount -t vfat /dev/sbd1 /media/disk

After it is mounted, the root user has full access to it.

Some additional option:
The -o option allows mounting file system with comma separated list of addional option such as;

  • ro : Read only
  • rw : Read / write
  • user: allows ordinary user to mount
  • check = none : mount without performing integrity test
  • loop : mounts a file

Unmounting a file

The $umount command unmounts a file
*$umount [direcotry|device]
Eg. $ umount /home/rich/mnt

Also check:

Top comments (0)