fdisk

HTGWA: Partition, format, and mount a large disk in Linux with parted

This is a simple guide, part of a series I'll call 'How-To Guide Without Ads'. In it, I'm going to document how I partition, format, and mount a large disk (2TB+) in Linux with parted.

Note that newer fdisk versions may work better with giant drives... but since I'm now used to parted I'm sticking with it for the foreseeable future.

List all available drives

$ sudo parted -l
...
Error: /dev/sda: unrecognised disk label
Model: ATA Samsung SSD 870 (scsi)                                         
Disk /dev/sda: 8002GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Good, I had plugged in that SSD just now, and it's brand new, so it doesn't have a partition table, label, or anything. It's the one I want to operate on. It's located at /dev/sda. I could also find that info with lsblk.

Format eMMC storage on an Orange Pi, Radxa, etc.

To use eMMC modules on the Orange Pi, Radxa, Milk-V, etc. as a writable volume in Linux, you need to delete the existing partitions (on my old Orange Pi, it was formatted as FAT/WIN32), create a new partition, format the partition, then mount it:

  1. Delete the existing partitions, and create a new partition:
    1. sudo fdisk /dev/mmcblk1
    2. p to list all partitions, then d and a number, once for each of the existing partitions.
    3. n to create a new partition, then use all the defaults, then w to write the changes.
  2. Format the partition: sudo mkfs.ext4 -L "emmc" /dev/mmcblk1p1
  3. Create a mount point: sudo mkdir -p /mnt/emmc
  4. Mount the disk: mount /dev/mmcblk1p1 /mnt/emmc

Note your eMMC device may be a different ID, e.g. mmcblk2 or mmcblk0, depending on the order the board firmware loads multiple devices in. Check with lsblk to see which device you would like to modify.