Differences
This shows you the differences between two versions of the page.
linux_wiki:list_create_delete_partitions_on_mbr_and_gpt_disks [2016/03/03 21:30] billdozor [GPT] |
linux_wiki:list_create_delete_partitions_on_mbr_and_gpt_disks [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== List Create Delete Partitions On Mbr And Gpt Disks ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | * Disks with a MBR (master boot record) are limited to 4 primary partitions and 2TB max usable size. | ||
- | * Use fdisk or parted. | ||
- | * Disks with GPT lift both of these restrictions. | ||
- | * Use gdisk or parted. | ||
- | |||
- | ---- | ||
- | |||
- | ==== MBR ==== | ||
- | |||
- | List MBR partitions | ||
- | <code bash> | ||
- | fdisk -l /dev/sdb | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create MBR partitions | ||
- | <code bash> | ||
- | fdisk /dev/sdb | ||
- | m (help) | ||
- | n (add new partition) | ||
- | p (primary) | ||
- | default (partition number) | ||
- | first sector (default 2048) | ||
- | last sector: +20G (to have a 20G partition) | ||
- | w | ||
- | </ | ||
- | |||
- | \\ | ||
- | Change partition type | ||
- | <code bash> | ||
- | fdisk /dev/sdb | ||
- | t | ||
- | selected partition: 1 | ||
- | Hex code: 83 (linux) | ||
- | w | ||
- | </ | ||
- | |||
- | \\ | ||
- | Delete MBR partitions | ||
- | <code bash> | ||
- | fdisk /dev/sdb | ||
- | d | ||
- | Partition number: 1 | ||
- | w | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== GPT ==== | ||
- | |||
- | List GPT partitions | ||
- | <code bash> | ||
- | gdisk /dev/sdb | ||
- | p (print partition table) | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create GPT partitions | ||
- | <code bash> | ||
- | gdisk /dev/sdb | ||
- | n | ||
- | default (partition number): 1 | ||
- | first sector (default 2048) | ||
- | last sector: +20G (to have a 20G partition) | ||
- | Hex code type: 8300 default | ||
- | w | ||
- | </ | ||
- | |||
- | \\ | ||
- | Delete GPT partitions | ||
- | <code bash> | ||
- | gdisk /dev/sdb | ||
- | d | ||
- | Partition number (if more than one):2 | ||
- | w | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== Re-read Partition Table ==== | ||
- | |||
- | Sometimes, after you create a new partition and write changes, you could see this message: | ||
- | <code bash> | ||
- | OK; writing new GUID partition table (GPT) to /dev/xvdf. | ||
- | Warning: The kernel is still using the old partition table. | ||
- | The new table will be used at the next reboot. | ||
- | The operation has completed successfully. | ||
- | </ | ||
- | |||
- | Instead of rebooting, inform the kernel that changes have been made on the disk: | ||
- | <code bash> | ||
- | partprobe /dev/xvdf | ||
- | </ | ||
- | |||
- | ---- | ||