Introduction to using Fdisk in Linux

Source: Internet
Author: User
Article Title: Introduction to the use of Fdisk in Linux. 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. fdisk functions in Linux are extremely powerful. It can be used to divide the most complex partitions, the following briefly introduces its usage:
 
For an IDE hard disk, each disk has a device name that corresponds to the four IDE interfaces of the motherboard. The device names are/dev/hda,/dev/hdb,/dev/hdc, /dev/hdd, etc. If there is an ide raid card, the following parameters are supported:/dev/hde,/dev/hdf,/dev/hdg,/dev/hdh. for SCSI hard disks, the device names are/dev/sda,/dev/sdb ...... And so on.
 
Fdisk command line usage: fdisk hard disk device name
 
After entering fdisk, type 'M' to display all the fdisk menus.
 
Type 'P' to display the current Partition Table status.
 
Type 'n', add a partition, and then prompt you to select the partition type (Basic partition or extended partition), and then select the Partition Number (1-4 ). Note: Each hard disk can be divided into up to four primary partitions (including basic partitions and extended partitions). A maximum of four basic partitions can be divided, and a maximum of one extended partition can be divided, however, you can divide multiple logical partitions in the extended partitions (I have not tried at most, but there are many logical partitions ). After selecting the partition type and partition number you want to create, the system will prompt you to enter the starting cylinder, starting from 1, and then entering the ending cylinder. At this time, you can enter the actual number of cylinders, it can also be input in the "+ partition size" mode, for example, + 1024M indicates adding 1024M to the start cylindrical surface. the device names in the primary partition are/dev/hda1,/dev/hda2,/dev/hda3,/dev/hda4, and the device names in the logical partition are as follows: /dev/hda5,/dev/hda6,/dev/hda7 ...... And so on.
 
Type 'D' to delete the partition. Enter the Partition Number to delete the partition. Note: When you delete an extended partition, all logical partitions are also deleted.
 
Type 'T' to change the partition flag (this is the most essential part of Linux fdisk !), The default identifier of the new partition is 83 (Linux Ext2). You can change it to 82 (Linux swap zone), 'B' (FAT32), 'F' (FAT32 Extend, limited to extended partitions), '86' (NTFS )...... And so on. In this way, friends who use multiple operating systems can use Linux fdisk to divide all the partitions you want!
 
Type 'A' to switch to partition activation. Note: each time you type a partition, the selected partition changes once between activation and non-activation, but you must ensure that only one partition is activated. In this case, the 'p' command is obtained. The activated partition has a '*' number.
 
In addition to the preceding commands, there are several other commands that are not commonly used.
 
Finally, type 'W'. The changes you made to the partition are written to the hard disk. Type 'q' to discard all the changes.
 
Flexible application of fdisk can also repair damaged partition tables on the premise that you must accurately remember the start and end cylinders of each original partition.
 
Add the following method to format the hard disk:
 
To Format partitions into Linux Ext2 format, use: mkext2fs/dev/hda?
 
To format the partition into FAT32 format, use: mkfs. vfat/dev/hda?
 
/Sbin/mkfs. ext3/dev/sda2
 
Mkdir/test
 
Modify/etc/fstab and restart the computer.
 
/Dev/sda2/test ext3 defaults 1 1
 

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.