Create a GPT disklabel (partition table)

# 1. Open the disk (replace /dev/sdX with your actual disk, e.g., /dev/sda)
sudo parted /dev/sdX

# 2. Set the disk label to GPT (this erases existing data!)
(parted) mklabel gpt

# 3. Create partitions (example: a 2TB primary partition)
(parted) mkpart primary 0.00TB 2.00TB

# 4. (Optional) Create another partition for swap
(parted) mkpart primary 2.00TB 100%

# 5. View partitions
(parted) print

# 6. Exit parted
(parted) quit

# 7. Format the new partition (e.g., the first one)
sudo mkfs.ext4 /dev/sdX1
Code language: PHP (php)