Partitioning
Stuff
Master boot record on Wikipedia.
fdisk
sfdisk – display or manipulate a disk partition table
sfdisk reads and writes partition tables, but are not interactive like fdisk or cfdisk (it reads input from a file or stdin).
gdisk – Interactive GUID partition table (GPT) manipulator
Wipe out GPT (zap)
root@SERVER:~# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): x
Expert command (? for help): z
About to wipe out GPT on /dev/sda. Proceed? (Y/N): Y
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Y
sgdisk – Command-line GUID partition table (GPT) manipulator for Linux and Unix
sgdisk --zap-all /dev/sdX
sgdisk reads and writes partition tables, but is not interactive like fdisk or cfdisk (it reads input from a file or stdin).
parted – a partition manipulation program
$ parted /dev/sdb print
Error: /dev/sdb: unrecognised disk label
Model: asmedia ASMT1153e (scsi)
Disk /dev/sdb: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:
parted /dev/disk/by-id/scsi-3..55d mklabel gpt mkpart P1 btrfs 2048s 100%
wipefs – wipe a signature from a device
Prints information about sda and all partitions on sda
wipefs /dev/sda*
wipefs /dev/mapper/mpathe
Erases all signatures from the device /dev/sdb
wipefs --all /dev/sdb
To find the right disk:
tree /dev/disk/by-id/
blkdiscard – discard sectors on a device
blkdiscard is used to discard device sectors. This is useful for solid-state drivers (SSDs) and thinly-provisioned storage. Unlike fstrim(8), this command is used directly on the block device.
By default, blkdiscard will discard all blocks on the device. Options may be used to modify this behavior based on range or size, as explained below.
Misc
4k sector size
https://en.wikipedia.org/wiki/Advanced_Format
https://developer.ibm.com/tutorials/l-linux-on-4kb-sector-disks/
https://www.seagate.com/gb/en/tech-insights/advanced-format-4k-sector-hard-drives-master-ti/