For the code, I’m just going to assume the drive is /dev/sdb. If you’re following this, make sure you’re using the correct drive name.
Unmount The Drive
Only needed if it’s been mounted already.
sync
umount /dev/sdb1
Prepare the Drive
Fire up fdisk
fdisk /dev/sdb
If you already have a filesystem on the disk, wipe it.
Press d
Now create a new primary partition.
Press n
Enter the partition type.
Press p (primary)
Enter the partition number.
Press 1
It’ll now ask you to set the start and end cylinders on the disk. Just hit return for each to accept the defaults.
Change the system type to Linux.
Press t
Enter 83
Write the changes to disk (this can’t be undone).
Press w
Create the Filesystem
Format the new partition using Ext4.
mkfs.ext4 /dev/sdb1
It’ll now go off and start writing the filesystem. This can take a bit of time, but it should give you an update on what’s being written.
Mount Your Drive
Now your partition has been created, you need to mount it somewhere to use it. Here I’m using /mnt/user/ext/.
mount /dev/sdb1 /mnt/user/ext/