a short sum-up on how to (re-)format your hard- or usb drive from the command line using fdisk.
Don’t do any of this unless you fully understand what you are trying to do.
This will wipe your drive clean, deleting all that’s on it.
To list available drives on you machine type:
Choose the drive you want to make changes to and engage it using fdisk:
replace the “sdc” with the drive you want to edit.
Changes you make using fdisk are only made permanent if you then issue the “w” command. You can abort any time using ctrl – c
Enter “p” to see the partition table of the drive.
Delete any existing partitions, using “d”
Now to create a new partition
Type “n” – “Enter” – Then press “p” to create a primary partition and choose 1 as partition number.
After specifying the size the partition table is created and you can use the “p” command to check it. Y
Now set the filesystem type for your new partition with the “t” command.
press L to see the hex code for the filesystem you need.
83 is ext2 Linux which is used in the rest of this example.
After you’ve set the filesystem use the “w” command to write your new partition table and exit fdisk.
Now you need to create the filesystem on the drive. using “mkfs”
mkfs -t ext2 /dev/sdc1
Now run a check on the drive and enter it into your fstab so that the drive mounts each time you start your computer.
This can be done with a single fsck command:
fsck -f -y /dev/sdc1
After fsck runs, you’re done.
Restart your system before using the drive