Format the hard disk with Fdisk partition on Linux

Source: Internet
Author: User
Tags hex code
Article Title: format the hard disk with Fdisk partition on the Linux system platform. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic classification formatting and partitioning
 
Hd-IDE device sd-SCSI Device
 
Fdisk-l/dev/sda view the first hard disk partition
 
Fdisk/dev/sdb partitions the second Hard Disk
 
Command acton (m for help): m # displays the command list
 
A-set the bootable flag; B-set the volume label; d-delete a partition; n-create a partition.
 
P-display partition information; v-verify Partition Table; q-do not save disk exit; w-save disk exit; t-change partition type
 
Command acton (m for help): n creates a partition.
 
Command action
 
E extended # extended partition
 
P primary partition (1-4) # primary partition
 
P # create a primary Partition
 
Partition number (1-4): 1 # create the first primary partition
 
First cylinder (1-522, default 1): 1 # Start cylindrical (the first partition is always 1)
 
Last cylinder or + size or + sizeM or + siezK (1-522, default 522): 10 # End cylindrical (if 522, the entire hard disk is allocated to a zone) the partition size is automatically calculated by the system based on the cylindrical size.
 
Command acton (m for help): n
 
Command action
 
E extended
 
P primary partition (1-4)
 
P
 
Partition number (1-4): 2 # create the second primary partition
 
First cylinder (11-522, default 11): 11
 
Last cylinder ...... (11-522, default 522): + 100 M # custom partition size
 
Command acton (m for help): n
 
Command action
 
E extended
 
P primary partition (1-4)
 
E # create an extended partition. Note that only one extended partition can be created for one disk.
 
Partition number (1-4): 3
 
First cylinder (28-522, default 28): 28
 
Last cylinder ...... (28-522, default 522): 522 # allocate all the remaining space to the extended partition
 
Extended partitions cannot be used directly. You must create logical partitions on them!
 
Command acton (m for help): n
 
Command action
 
L logical (5 or over) # logical Partition
 
P primary partition (1-4)
 
L
 
First sylinder (28-255, default 28): 28 # create a logical partition in the extended partition
 
Last cylinder ...... (28-522, default 522): 522 # It means that only one logical partition is created.
 
Command acton (m for help): w # Save and exit
 
Convert partition type:
 
Command acton (m for help): t # convert the partition type
 
Partition number (1-4): 2 # select the second primary partition
 
Hex code (type L to list codes): 82 # encoding corresponding to the partition type can be listed by L
 
Format and mount: (you can create or specify an empty directory)
 
Mksf. ext3/dev/sdb1 format the first primary partition of the second hard disk as ext3
 
Mkswap/dev/sdb2 initializes the swap zone, which cannot be formatted.
 
Mount/dev/sdb1/mnt/d # mount the first partition to the d directory.
 
Automatic mounting after restart: vi/etc/fstab
 
Add:/dev/sdb1/mnt/d ext3 default 0 0
 
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.