fdisk under Linux is extremely powerful; with it you can create the most complex partitions. Below is a brief introduction to its usage:
For IDE hard disks, each disk has a device name: corresponding to the four IDE interfaces on the motherboard, the device names are, in order: /dev/hda,/dev/hdb,/dev/hdc,/dev/hdd, etc. If there is also an IDE Raid card, then they are, in order: /dev/hde,/dev/hdf,/dev/hdg,/dev/hdh. For SCSI hard disks, the device names are /dev/sda,/dev/sdb... and so on.
The command-line usage of fdisk is: fdisk hard disk device name
After entering fdisk, first type 'm', and the full fdisk menu will be displayed.
Then type 'p' to display the current partition table status.
Type 'n' to add a partition, and then it will prompt you to choose the partition type (primary partition or extended partition), then choose the partition number (1-4). Note: each hard disk can be divided into at most four main partitions (including primary partitions and extended partitions), among which: at most four primary partitions can be created, and at most one extended partition can be created, but multiple logical partitions can be divided inside an extended partition (I have not tried how many at most; in any case, a lot). After selecting the partition type and partition number you want to create, it will prompt you to enter the starting cylinder, beginning from 1; then enter the ending cylinder. At this point you can enter the actual number of cylinders, or enter it in the form of "+partition size", for example: +1024M means adding 1024M after the starting cylinder. The device names of primary partitions are, in order: /dev/hda1,/dev/hda2,/dev/hda3,/dev/hda4, and the device names of logical partitions are, in order: /dev/hda5,/dev/hda6,/dev/hda7... and so on.
Type ’d‘ to delete a partition; enter the partition number and it will be deleted. Note that when deleting an extended partition, all logical partitions will also be deleted at the same time.
Type ’t‘ to change the partition flag (this is the most essential part of Linux fdisk!). The default flag for a newly created partition is 83 (Linux Ext2). You can change it to 82 (Linux swap area), or 'b' (FAT32), 'f' (FAT32 Extend, only for extended partitions), '86' (NTFS)... and dozens of other types. In this way, friends using multiple operating systems can use Linux fdisk to create all the partitions you want!
Type 'a' to toggle the partition active switch. Please note: each time you type it, the selected partition will change once between active and inactive, but you must ensure that in the end only one partition is active. This is where the 'p' command comes in; an active partition will have a '*' mark on it.
Besides the commands above, there are several others, but they are not used very often.
Finally, type ’w' and the changes you made to the partitions will be written to the hard disk; type 'q' to discard all modifications.
By using fdisk flexibly, you can also repair some damaged partition tables, provided that you must accurately remember the original starting cylinder and ending cylinder of each partition.
Also adding the method for formatting a hard disk:
To format a partition as Linux Ext2, use: mkext2fs /dev/hda?
To format a partition as FAT32, use: mkfs.vfat /dev/hda?
For IDE hard disks, each disk has a device name: corresponding to the four IDE interfaces on the motherboard, the device names are, in order: /dev/hda,/dev/hdb,/dev/hdc,/dev/hdd, etc. If there is also an IDE Raid card, then they are, in order: /dev/hde,/dev/hdf,/dev/hdg,/dev/hdh. For SCSI hard disks, the device names are /dev/sda,/dev/sdb... and so on.
The command-line usage of fdisk is: fdisk hard disk device name
After entering fdisk, first type 'm', and the full fdisk menu will be displayed.
Then type 'p' to display the current partition table status.
Type 'n' to add a partition, and then it will prompt you to choose the partition type (primary partition or extended partition), then choose the partition number (1-4). Note: each hard disk can be divided into at most four main partitions (including primary partitions and extended partitions), among which: at most four primary partitions can be created, and at most one extended partition can be created, but multiple logical partitions can be divided inside an extended partition (I have not tried how many at most; in any case, a lot). After selecting the partition type and partition number you want to create, it will prompt you to enter the starting cylinder, beginning from 1; then enter the ending cylinder. At this point you can enter the actual number of cylinders, or enter it in the form of "+partition size", for example: +1024M means adding 1024M after the starting cylinder. The device names of primary partitions are, in order: /dev/hda1,/dev/hda2,/dev/hda3,/dev/hda4, and the device names of logical partitions are, in order: /dev/hda5,/dev/hda6,/dev/hda7... and so on.
Type ’d‘ to delete a partition; enter the partition number and it will be deleted. Note that when deleting an extended partition, all logical partitions will also be deleted at the same time.
Type ’t‘ to change the partition flag (this is the most essential part of Linux fdisk!). The default flag for a newly created partition is 83 (Linux Ext2). You can change it to 82 (Linux swap area), or 'b' (FAT32), 'f' (FAT32 Extend, only for extended partitions), '86' (NTFS)... and dozens of other types. In this way, friends using multiple operating systems can use Linux fdisk to create all the partitions you want!
Type 'a' to toggle the partition active switch. Please note: each time you type it, the selected partition will change once between active and inactive, but you must ensure that in the end only one partition is active. This is where the 'p' command comes in; an active partition will have a '*' mark on it.
Besides the commands above, there are several others, but they are not used very often.
Finally, type ’w' and the changes you made to the partitions will be written to the hard disk; type 'q' to discard all modifications.
By using fdisk flexibly, you can also repair some damaged partition tables, provided that you must accurately remember the original starting cylinder and ending cylinder of each partition.
Also adding the method for formatting a hard disk:
To format a partition as Linux Ext2, use: mkext2fs /dev/hda?
To format a partition as FAT32, use: mkfs.vfat /dev/hda?
http://dos.e-stone.cn/dosbbs
uploadImages/200311161145850422.swf
uploadImages/200311161145850422.swf

