How to Do a Fresh Format on a new or Used Drive

I have been having problems with my old SATA and IDE drives. Windows or Linux cannot see the drives when I attach them to my USB docking station. However, when plugged directly into the SATA or IDE ports on the computer, the drive is recognized.

This tutorial is to recover the drives and reformat them for use on Linux boxes:

Step 1:
Attached the drive in a Linux box.

Step 2:
Type lsblk. You should see something like this. Typing lsblk -f will let you know the filesystem.

Tech Tutorial Image 1

sda will be your primary Linux drive and sdb or any other sd* will be the drive you are trying to recover.

Step 3:
We will use the command line version of Gparted, called Parted, to Download parted by typing: sudo apt-get install parted

Step 4:
We will now recover what data is in sdb drive, so we need to mount it in Linux. First, create a folder to mount the drive to. For me it will be in /home/tester/driverecover
# sudo mkdir /home/tester/driverecover.
Now we will mount it (note, we are assuming that the drive is ntfs).
# sudo mount -t ntfs-3g /dev/sdb1 /home/tester/driverecover

An ext4 file system can be mounted with no extra options. For example:
# sudo mount /dev/sdb1 /home/tester/driverecover

Now we can recover any files in the drive.

Step 5:
We will first create a fresh ext4 partition table which will eliminate the ntfs table. When you type parted and the drive name, you will be in the parted program:
# sudo parted /dev/sdb

You will now see this:
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.

Type this in the command line:
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdX will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes

Next type:
(parted) mkpart
Partition name? []? storage
File system type? [ext2]? ext4
Start? 0%
End? 100%

Now we will quit the parted:
(parted) quit

Next we will format the drive:
# mkfs.ext4 /dev/sdb1

You probably want to be able to use 100% of your storage space, so let’s remove root allocated space witch uses 5% of the disk by default:
# tune2fs -m 0 /dev/sdb1

Then we give a name to the partition (optional) and call it media:
# e2label /dev/sdb1 media

The drive has now been partitioned and formatted to ext4.