Disk partitioning
parted
Arch wiki: parted Parted Manual Beware of Rounding:
when creating a partition, you should prefer to specify units of bytes (“B”), sectors (“s”), or IEC binary units like “MiB”, but not “MB”, “GB”, etc.
Script mode:
sudo parted --script /dev/sdX COMMAND
Or interactively:
sudo parted /dev/sdX
Use GPT as partition table:
mklabel gpt
Or for sdcards/compability with legacy devices:
mklabel msdos
Create partition (GPT):
mkpart "data partition" ext4 0% 100%
mkpart "ventoy" ext4 0% 64GiB
mkpart "data" ext4 64GiB 100%
quit
Then format the disk:
sudo mkfs.ext4 -m0 -L usbstick /dev/sdX1
or for vfat:
sudo mkfs.vfat -n fotos /dev/mmcblk0p1
Examples
Create a new single patition on i.e. a usb drive and format it with FAT32:
sudo parted -s /dev/sdX -- mklabel msdos mkpart primary fat32 2048s -1s
sudo mkfs.vfat -F 32 /dev/sdX1