fdisk - the general name of system utilities for managing hard disk partitions . Widespread and available in almost any operating system, but they work in different ways. Use a text user interface .
Content
Use on Linux
On Linux, you can run fdisk interactively or in command mode. At startup, you must specify the disk device, for example: / dev / hdb, / dev / sda, etc. In some cases (when changing the partition in command mode), you will need to specify the disk partition (for example / dev / hda1).
Command Mode
fdisk -v Version Output
fdisk [-b SSZ] [-u ] DISK Change partition table
fdisk -l [-b SSZ] [-u] DISK List partition table (s)
fdisk -s PARTITION Give partition size (s) in blocks
-u: give Start and End in sector (instead of cylinder) units
-b 2048: (for certain MO disks) use 2048-byte sectors
Interactive Mode
If at startup you specify only the name of the drive, fdisk starts interactively.
Using fdisk in scripts
This command emulates the user's work:
fdisk / dev / hda << EOF n p one a one t c w Eof
Fdisk commands: n - create a new partition
p - the new partition will be "primary" (primary) (you can enter "e" - extended (extended))
1 - the primary partition will be the first of four possible (for USB-ZIP must be 4th)
a - make the partition active 1 - make the first section active
t - change the type of the partition с - change the type of the partition to Fat32 (LBA)
w - write changes to disk and exit fdisk
See also
- cfdisk is a utility similar to fdisk, but using a more convenient console interface.
- diskpart - a utility replacing fdisk in Windows NT