Monday, May 6, 2013

Fdisk

Fdisk is use to manipulate disk partition table
There is also a simply GUI of fidisk, cfdisk.
For run fdisk (or cfdisk) you need root user.
The device is usually /dev/sda, /dev/sdb, dev/sdc and so on for SCSI device instead for IDE device is usually /dev/hda, /dev/hdb and so on.
You can see your device on /dev (ls /dev).
Type - sudo fdisk /dev/sda - for use sda partition.
Now if you type p you can see your partition table.
If you type v you can verify the partition table, for example:
Remaining 62 unallocated 512-byte sectors
With d you can delete a parition instead with n you can create new partition.
If you create new partition you can choice if create primary partition of extended (max 4 primary partition!):
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
For a complete list of command action type m.

You can specify some options when you run fdisk:
-b sectorsize: Specify the sector size of the disk. Valid values are 512, 1024, 2048 or 4096.
-c=mode: Specify the compatibility mode, 'dos' or 'nondos' (default c=nondos)
-l : List the partition tables for the specified devices and then exit.
-s partition: Print the size (in blocks) of each given partition.
ex : sudo fdisk -s /dev/sda1
9767488
sudo fdisk -s /dev/sda
156290904

If you have any problem or you need some explanations just write under this post!

No comments:

Post a Comment