List all devices:
$> sudo fdisk -l
That will give you an overview about all your drives like that:
Disk /dev/sda: 256.1 GB, 256060514304 bytes 255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d9f0d Device Boot Start End Blocks Id System /dev/sda1 * 2048 499711 248832 83 Linux /dev/sda2 501758 500117503 249807873 5 Extended /dev/sda5 501760 500117503 249807872 8e Linux LVM Disk /dev/mapper/ubuntu--vg-root: 247.3 GB, 247325523968 bytes 255 heads, 63 sectors/track, 30068 cylinders, total 483057664 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table Disk /dev/mapper/ubuntu--vg-swap_1: 8468 MB, 8468299776 bytes 255 heads, 63 sectors/track, 1029 cylinders, total 16539648 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes 255 heads, 63 sectors/track, 1936 cylinders, total 31116288 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 31116287 15554048 c W95 FAT32 (LBA)
Format drive:
$> sudo fdisk /dev/mmcblk0p1
This will ask you for a command (help will show you all commands):
Command (m for help): help h: unknown command Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
Format FAT32:
$> sudo mkfs.vfat /dev/mmcblk0p1
2 thoughts on “List, partitioning and format drives”