[Centos6, 3] use FDISK for disk partitioning and file system

Source: Internet
Author: User
Tags superuser permission
Part 1: fdisk partitioning tool I. fdisk partitioning tool: 1fdisk is a legacy partitioning tool from IBMD and supports most operating systems. Fdisk is installed in almost all linux releases, including in linux rescue mode. 2fdisk is based on

Part 1: fdisk partitioning tool

I. fdisk partitioning tool:

1. fdisk is a legacy partitioning tool from IBMD and supports most operating systems. Fdisk is installed in almost all linux releases, including in linux rescue mode. 2. fdisk is an MBR-based partitioning tool. Therefore, if GPT is required, fdisk cannot be used for partitioning.

II. FDISK

1. the fdisk command can only be run with the superuser permission. 2. use fdisk-1 to list all installed disks and their partition information. 3. use fdisk/dev/sda to partition the Target Disk. 4. After partitioning, you need to adapt to the partprobe command to let the kernel update the partition information. Otherwise, you need to restart the kernel to identify the new partition. the 5/proc/partitions file can also be used to view the partition information.

Part 2: File system

I. file system:

1. a partitioned disk cannot be used directly. you need to create a file system to use it. 2. the operating system manages files and data through the file system. a disk or partition must be created before it can be used by the operating system. The process of creating a file system is also called formatting. 3. a device without a file system is called a raw device. 4. common file systems include fat32, NTFS, ext2, ext3, ext4, xfs, and HFS. differences between files: whether to include logs, supported partition sizes, supported single file sizes, and performance. 6. the mainstream file system in windows is NTFS. mainstream file systems in linux are: EXT3 and Ext4.

2. create a file system on the disk:

1. run the mke2fs command to create a file system # specify the/dev/sda3 device as the ext4 file system mke2fs-t ext4/dev/sda3 common parameters:-t: specify the type of file system creation-B blocksize: specify the size of the file system block (file system block size: the minimum unit for each file system read/write operation, 4 KB by default)-c: check the damaged block-L label when creating a file system: specify the volume label-j. create a file system log

2. the command mkfs can also be used to create a file system. compared with mke2fs, mkfs is simple. when few parameters are supported, it cannot be precisely controlled. Example: mkfs. ext3/dev/sda3 mkfs. ext4/dev/sda3 mkfs. vfat/dev/sda3

3. run the DUMPE2FS command to view the file system information of the partition. dumpe2fs/dev/sda2

3. JOURNAL logs:

1. the file system with logs (ext3 and ext4) has strong stability and can be restored when an error occurs. 2. when a file system with logs is used, the file system uses a "two-phase commit" method to perform disk operations. When disk operations are performed, the file system performs the following operations: ①. the specific content of the transaction to be executed by the file system is written into the log. ②. File system operation ③. after the operation is successful, delete the specific transaction content from the log. The advantage of doing so is that when a transaction is executed unexpectedly (such as a breakpoint or disk failure), you can query the log for recovery. The disadvantage is that it will lose some performance (additional log read/write operations ).

IV. E2LABEL command

The command e2label can be used to add labels to the file system. (we recommend that you use uppercase labels) e2label/dev/sda2: Display the system label e2label/dev/sda2/LINUXCASAT of sda2. set the system label of sda2 to LINUXCASAT.

V. FSCK command:

The command fsck is used to check and repair damaged file systems. the file system must be uninstalled before the command is executed. Fsck/dev/sda2 1. use the-y parameter to fix it without prompting. 2. by default, fsck automatically determines the file system type. if the file system is seriously damaged, use the-t parameter to specify the file system type. 3. for corrupted data identified as a file (the file system has no records), fsck will put the file into the lost + found Directory (each formatted disk will have a lost + found directory by default) 4. the system performs fsck operations on the disk at startup.

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.