Linux partitioning, formatting, and mounting

Source: Internet
Author: User
What is partition? Partitioning refers to telling the operating system that the disk is divided into several partitions by the cylindrical range. For example, if one to 50 cylinders are used as sda1 and 51-100, what is partition? Partitioning refers to telling the operating system that the disk is divided into several partitions by the cylindrical range. For example, 1-50 cylinders are used as sda1, and 51-cylinder are used as sda2 partitions. In this way, a hard disk (or lun) is divided into smaller and better management units. next we can format different partitions into different file systems.
What is formatting? What is the purpose of formatting a partition into a file system? After the file system is introduced, each program accesses the disk through the file system interface. the file system ensures the sequence of access to the same file, provides a directory tree, and limits user permissions. Without a file system, each user directly calls the disk controller driver and cannot limit the file permission, and may overwrite each other on the disk.
Add a 20 GB scsi hard disk to the virtual machine vmware workstation.
No disk is found. it indicates that the disk needs to be restarted. The operation of adding a disk is cold addition. [Root @ pri dev] # ls "grep sdsdasda1sda2sda3 after restarting, you will be able to see the newly added sdb. [Root @ pri dev] # ls | grep sdsdasda1sda2sda3sdb
Then use the fdisk command to partition, m is help, n is add, w is save. [Root @ pri dev] # fdisk/dev/sdbCommand (m for help ): m # HELP Command action a toggle a bootable flag B edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) command (m for help): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 1 First cylinder (1-1566, default 1 ): using default value 1 Last cylinder or + size or + sizeM or + sizeK (1-1566, default 1566): 100 Command (m for help ): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 2 First cylinder (101-1566, default 101 ): 101 Last cylinder or + size or + sizeM or + sizeK (101-1566, default 1566): 200 Command (m for help ): nCommand action e extended p primary partition (1-4) 3 Invalid partition number for type '3' Command action e extended p primary partition (1-4) pPartition number (1-4): 3 First cylinder (201-1566, default 201): Using default value 201 Last cylinder or + size or + sizeM or + sizeK (201-1566, default 1566 ): 300 Command (m for help): nCommand action e extended p primary partition (1-4) 4 Invalid partition number for type '4'
When the number is increased to 4th, no more. It is proved that the primary partition can have at most three partitions, and the remaining one can only be used as the extended partition.
Command (m for help): nCommand action e extended p primary partition (1-4) eSelected partition 4 First cylinder (301-1566, default 301 ): using default value 301 Last cylinder or + size or + sizeM or + sizeK (301-1566, default 1566): 400 Command (m for help): nFirst cylinder (301-400, default 301): Using default value 301 Last cylinder or + size or + sizeM or + sizeK (301-400, default 400): Using default value 400
If we divide another extended partition, 301-400, and then divide it by n, we can only divide the logical partition from the extended partition of 400-, and the cylinder will be wasted after. In addition, the objects we format later can only be primary partitions and logical partitions, but not extended partitions.
Format mkfs-t ext3/dev/sdb1 to format the sdb1 partition into an ext3 file system. The formatted partition can be reformatted into another file system, such as ext2 and vfs.
Mount: it refers to the operation of combining the file system with the directory tree. it is called Mount. [Root @ pri dev] # cd/u01 [root @ pri u01] # lsapp [root @ pri u01] # mkdir test [root @ pri u01] # mount/dev/sdb1/ u01/test [root @ pri u01] # cd/u01/test [root @ pri test] # df-h. filesystem Size Used Avail Use % Mounted on/dev/sdb1 773 M 17 M 716 M 3%/u01/test the mount point must be a directory, which is the entry to the file system. If mounting is not performed, the file system cannot be used.
Related Article

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.