Disk format, mount and unload, and partition table Fstab

Source: Internet
Author: User

First, the format of the disk


After we use the FDISK command to partition the disk, the disk is still not able to be used directly, the disk needs to be formatted, and the essence of formatting is to install the file system for the disk


We use the command: MKE2FS to install the file system for the CentOS system, the following is a look at the common options for MAK2FS:


-B: The size of each block is set at the time of partitioning, and the size of each chunk currently supported is 1024, 2048, 4096


-I: Sets the size of the inode (the storage domain for file meta information)


-N: Sets the number of inode (in case the default inode number is insufficient)


-C: Check disk for problems before formatting


-L: Default label for this partition


-j: Creating a ext3 format partition


-T: Specifies the type of file system (ext2, Ext3, EXT4)


-M: Specifies the percentage of disk that is reserved to administrators for the MKE2FS command (EXT4 file system) when formatting


example, the partition SDB1 is formatted as a EXT4 file system: Mke2fs-t EXT4/DEV/SDB1


The specification of the size of the block and the label of the specified partition are similar to the usage, not to repeat


Command: E2label + partition name


View or modify the label of a partition



Second, the disk mount and unload


After the disk format, you need to mount it to use, you can say Fdisk, MKE2FS, mount these three commands are inseparable (of course, in addition to mount the optical drive). The formatted disk is actually a block device file (that is, a hardware device) that needs to be mounted for use, and we need to set up a mount point (in the form of a directory) when we mount it, and if we mount a partition to this directory, the data we write to that directory will be written to this partition. Note: The contents of this directory are not visible after mounting, the partition can be seen after unloading


Detailed command:


Mount: When using this mount alone, you can see how the disk is mounted at this time


DMESG |tail: Use this command to view errors when a disk cannot be mounted


mount/dev/sdb1/mnt/: Mount the partition/dev/sdb1 to the/mnt/directory, after the mount succeeds, use the LS command to view the contents of the mount point, which will show Lost+found


Df-h: View disk usage at this time


To prevent the disk from being identified incorrectly (mount the wrong partition), you can mount it using the UUID and label:


Command: Blkid, view the UUID and label of each partition and the file system type


Command: Mount Uuid= "...... ..... ................../mnt/...".


Command: Mount label=test/mnt/


Uninstall: Umount


This command is very simple to use, directly with the partition name or mount point, but not with the UUID and label, using the-l option can be forced to unload


Third, the partition table Fstab


When we want to enable automatic mount, the content can be written to the file


Uuid= "..."/MNT/EXT4 defaults 0 0 (...) ..... ......--------------


Or: Label=test/mnt/ext4 defaults 0 0


Or we can write the command to the file/etc/rc.d/rc.local to start it up:


Mount Uuid= "..... ................./mnt/..."....... "


Command: Mount-a, automatically mount the partitions that appear in the partition table/etc/fstab





This article is from "The Miracle Teenager" blog, please be sure to keep this source http://raffaelexr.blog.51cto.com/8555551/1720050

Disk format, mount and unload, and partition table Fstab

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.