Basic Linux File System Operations (mount mounting and umount unmount)

Source: Internet
Author: User

Review: disks and file management systems

7. introduces the basic concepts of Linux disks (MBR and Partition Table );

8. Introduces fdisk disk management (fdisk creates partitions );

9. describes the basic operations of the file system (create mke2fs, mkfs., tag e2label, query dumpe2fs, check and fix fsck );

10. This document describes how to mount and detach a file system (mount and umount)

How to mount and use a file system by using the mount command, mount common parameters, and enable automatic mounting (/etc/fstab)

10.1 mount)

After a file system is created for a disk or partition, You need to mount it to a directory (usually mounted under/mnt/) to use it.

Windows or MAC system will be automatically mounted (once a file system is created, it will be automatically mounted to the system), Windows is called C: disk D: Disk

Linux needs to be manually mounted-or configure the system to make it automatically mounted

/Dev/sdb1 ------>/mnt

Mount

 

Command mountDevice source (/dev/sdb1) Mount destination (/mnt)

For example, mount/dev/sdb1/mnt, such

Option)

-T specifies the file system type, such as-t ext3,-t ext4, and-t vfat.

-O specifies the mount option, for example:

-O ro and rw are mounted in read-only mode and in read/write mode. The default value is rw.

-O async indicates that all operations use the cache (memory): improves the efficiency of reading and writing data to the file system. By default, async uses the cache (memory );

-O sync indicates that all operations are directly written to the disk. It indicates that all operations are directly written to the disk instead of using the cache. Applications are used in scenarios with high data security.

-O atime indicates the time when the file is accessed. The default value is atime. atime = access time

-O noatime indicates that the time when the file is accessed is not updated

-O remount indicates re-mounting the File System

# Use the mount command without parameters to display all mounted file systems

# You can also write the mounting configuration to/etc/fstab, and enable automatic mounting.

 

10.2 unmount operation (umount)

Used to detach a mounted file system (partition), which is equivalent to a windows system pop-up

Command umount mountedDevice source (/dev/sdb1) or mounted destination (/mnt)

Command umountFile System/mount point

Umount/Dev/sdb1= Umount/Mnt

Example: umount/dev/sdb1 or umount/mnt/

 

If the error message "device is busy" appears, the file system is in use;

Run the following command (fuser) to check which processes are using this file system:

Fuser-m/mnt

You can also run the following command (lsof) to check which files or folders are opened or in use in the file system:

Lsof/mnt

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.