# fdisk -l ←List disk information Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes # fdisk /dev/sda ←Partition the disk "/dev/sda" (enters interactive mode, press <m> if you're unsure about available commands) |
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit ←Write partition and exit x extra functionality (experts only) |
In the example above, any changes made, such as deleting or adding partitions, are only performed in RAM. Even if a mistake is made, it won't affect the disk data. You can always press <q> to exit if you're unsure, which won't endanger the disk. Changes are only written to the disk when you press <w>. Therefore, before pressing <w>, it's advisable to press <p> to print the planned partitions to confirm.
For more advanced interactive mode and usage of fdisk, please refer to the provided link.