# refere to this page
# to delete previous partition table
$ sudo dd if=/dev/zero of=/dev/sda bs=1024 count=100
# find the device name
$ lsblk
# let the name be "sda"
# for now file system is not important; will be formatted with mke2fs
# "mklabel gpt" results in corrupted partition; don't know why.
$ sudo parted /dev/sda
(parted) mklabel msdos
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]?
Start? 4MiB
End? -1
(parted) print
Model: General UDisk (scsi)
Disk /dev/sda: 33.6GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 33.6GB 33.5GB primary ext2 lba
(parted) quit
Information: You may need to update /etc/fstab.
$ sudo mkfs.ext4 /dev/sda1
# "mkfs.ext4" can be replaced with "mke2fs -t ext4"