Linux down hard drive partition

Source: Internet
Author: User

1 fdisk-l view hard disk and partition information

The commands under my system (ArchLinux) have the following effects:

From the above picture can be learned that the system only mount 1 hard drives, named SDA, it has 2 primary partitions, SDA1 and sda2, as for why so named, you can refer to my other blog: Linux mount

It is obvious that the drive has a capacity of 931.5GB, a total of 1,953,525,168 sectors (sectors), of which 2048-2099200 of the fan is differentiated to the SDA1 partition, 2101248-1953525167 fan is differentiated to the sda2 partition,

Their capacity is 1GB and 930.5GB respectively, indicating that the hard disk capacity has been fully mounted, there is no free space.

2 start operating the hard drive

Command: FDISK/DEV/SDX

As follows:

Here you can enter m to see the various operation instructions, as follows:

Here are a few common parameters:

D Delete Partition

L List partition types

M list Help

n Add a partition

P List Partitions

Q Do not save exit

t change the partition type

W Save after exiting

3 Updating the kernel hard disk partition table

Command: Cat/proc/partitions

Function: View the partition information identified by the kernel

After using the Fdisk partition, you need to see if the kernel partition information is consistent with our operations, as follows:

If there are no changes to the partition, then we do not have to restart the kernel, just use the following command to re-read the partition information (refresh):

#partprobe/DEV/SDX

4 Formatting partitions

Once the partition is complete, it is necessary to assign a file system to each partition, which describes the more common command mkfs, which is in the following format:

MKFS [-v] [-t fstype] [-options] Device

-v: Verbose display mode

-t fstype: Select a file system, Linux default value is Ext2, can be specified as EXT2,EXT3,EXT4,MSDOS,FAT32,VFAT, etc.

-options: Some other parameters, such as-C, indicates that the disk bad track condition is checked during the formatting process, and the-l Bad_blocks_file indicates that the block information of the bad track is added to the Bad_blocks_file file

Device: Hard disk partitions, such as/DEV/SDA1

For example:

Mkfs-t ext4/dev/sda1

This command can be written mkfs.ext4/dev/sda1

At this point, the disk partition basically ends, then can be mounted and other operations.

Linux down hard drive partition

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.