0

Let's say I want to create 128-1024 GPT partitions on a SSD 1 TB drive (smallest possible, for even FAT). Let's also say that I can do that in Linux Mint 19.3. I assume that I do not want to create script which will call gdisk many times putting its output to gdisk, but looking for a simple solution beside manual adding of these partitions.

What would be the smartest way to do that?

pbies
  • 3,550

1 Answers1

0

I've created a bash script for that, seems working fine:

#!/usr/bin/env bash

# comment to run
exit 1

size=14680064
drive=sdb

{
    echo "label: gpt"
#   echo "label-id: 89B1365E-CD48-4A4C-95FB-117A92909321"
    echo "device: /dev/$drive"
    echo "unit: sectors"
    echo "first-lba: 2048"
#   echo "last-lba: 1953525134"
    echo
    # exFAT type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
    # NTFS type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
    # ext4 type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
    for i in {0..127}; do
        echo "start=" $(($i*$size+2048)) ", size=$size, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
    done
} | sfdisk /dev/$drive

# comment to run
exit 1

for i in {1..128}; do
    mkfs.exfat -n $i "/dev/$drive$i"
done

Thank you, @Robert!

PS. Don't mess with partitions near midnight! You can loose data!

PS2. Will try sgdisk later, thanks, @phuclv!

pbies
  • 3,550