Formatting an External Hard Drive in Linux

While transferring data to an external hard drive formatted in the FAT32 filesystem, the process had stalled.  At the time, I was only moving a couple of gigabytes.  I could only imagine what might happen if a similar thing occurred during a larger backup.  So I decided to make the move to a native Linux filesystem like ext3 for my backup drive.

My home computer is a Debian-based, Gnome desktop system.  The external device is made up of an older IDE drive that is housed in a SANMAX HD340 aluminum enclosure with USB connector.

Here is a list of some problems I encountered:

  • There was no option to simply right-click the drive and format as there is in the Windows operating system.
  • In Linux, the mounting and unmounting of a drive plays a role in how one can interact with devices.
  • I could not find a unified tool or application that would complete the task for me.

Below I outline some of the steps and the resources that helped me accomplish my goal.

First, I had to identify the drive by its device name.  I did this by using (as root) the df command …

localhost:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             293G   66G  212G  24% /
tmpfs                 757M     0  757M   0% /lib/init/rw
udev                   10M   48K   10M   1% /dev
tmpfs                 757M     0  757M   0% /dev/shm

In my case, the drive turned out to be /dev/sdb1 (not shown).  <;

I managed to make it as far as fdisk, but encountered an error related to the mount-state of the device. Fortunately, the Gnome Partition Editor (GParted ) allowed me to get past this issue from an unmounted-state.

There is some relevant information at <;.  However, I ended up having to remount the device under /media/usbdrive instead of /mnt as suggested in the article.  On a side note, I chose to forgo the steps outlined in the Automount In the Terminal section.

Referring back to the mkfs command as outlined in the first aforementioned article, I was able to see my newly formatted drive but could not copy-paste any files to it from my GUI file manager!

Evidently, after formatting the disk the only way I would be able to transfer files would be as root.  Considering that I do not normally log in as the superuser, I used a method described by malaire <;

sudo mount -o remount,rw /mnt/hda1
sudo mkdir /mnt/hda1/myfiles
sudo chown knoppix:knoppix /mnt/hda1/myfiles

Instead of mounting from the command line, I was able to right-click and mount from its Desktop icon.  And, as was previously mentioned, I had to use the /media directory.  In turn, I used chown (on the new directory) for my own user account.

I was finally able to copy files to my newly formatted external hard drive for my Linux system.

On final note, I have another (larger) external HDD that could use the same treatment.  I do not know how my system will treat this drive in terms of its NTFS filesystem and mount point.  At this time, I have enough space … but for how long?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: