From hard disk to partition-Linux general technology-Linux technology and application information, the following is a detailed description. After learning about the EXT2/3 system, how can I create a new partition on the disk and make it ready for use?
First, partition the disk after the hard disk is connected; fdisk [-l] disk name (instead of partition name) if the device name is not connected, the partition of the device that can be found in the system is listed, and the parameter is used to output the partition content connected to the disk. If the parameter-l is not specified, the operation is performed on the disk device to go to the fdisk work page. You can create or delete a partition. After the partition table is saved, the kernel cannot obtain the latest information of the partition table again. you need to restart the kernel. In fact, you only need to enter partprobe to force the kernel to find the partition table again.
Second, you need to format the hard disk after partitioning so that it can have a specific file system for use. the FORMAT command is very simple, command mkfs [-t file system] device file name (partition name. Mkfs is a neutralization command. it will call other corresponding formatting tool commands, such as mkfs? T ext3... Call the mkfs. ext3 command to perform the formatting operation. Therefore, you can enter mkfs and press the tab twice to view the file system that supports formatting.
Check the created partition. After formatting is complete, no one can determine whether the partition file system is faulty (or there are many problems such as computer usage and crashes). at this time, you need to check the disk. Fsck (fs check) [-t file system] common partition name parameter-A: scan the device based on/etc/fstab;-a [-y ]: automatically fix problematic sectors.-C shows the progress. Note that when performing fsck, it is best to unmount the partition. In addition, the e2fsck software is actually called when you use the fsck command.
Finally, mount the partition to the directory so that we can access and use the partition. The Mount point should first create an empty directory, and one directory should be mounted to only one file system. If it is not an empty directory, it can also be mounted. the original knowledge content will be hidden and will not be displayed until the partition is detached. Mount the file by using the mount command. Mount the partition directory;
Finally, you can use this partition to check which partitions (file system) are mounted on the current machine and run the command df. To understand the current partition and file system, know the type, capacity, usage, remaining amount and mount point of the file system. Df file is the information of the system that lists the partition where the directory or file name is located. Eg: df-h/etc is used to view the information of the file system in the partition where/etc is located.
We can also use the command dumpe2fs partition name to learn about each block group and superblock information of the partition file system. Can you go deeper? Query the files in the file system! Run the command du file/directory to check the file/directory capacity in the file system.
Note: these summaries are written by reference to laruence's private kitchen!
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