Linux format external USB hard disk Partition

Posted on in Categories , , , last updated December 22, 2006

Q. I have an external new hard drive connected using USB port under Red Hat Fedora Core Linux. I want to use it for backup. There are two partition /dev/sda1 and /dev/sda2. This hard disk was setup and formatted by friend under Windows XP (NTFS partition). Now I want to format and use one partition for Linux and another for Windows XP.

How do I format sda1 without losing data from /dev/sda2?

A. To format /dev/sda1 as Linux ext3 partition use command mkfs.ext3. It is used to create an ext2/ext3 filesystem

Type the command as follows:
# mkfs.ext3 /dev/sda1

Before hitting [enter] key make sure you double check partition device name (/dev/sda1). If unsure make backup of important data on USB pen or DVD disk.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

15 comment

  1. I have a usb drive without any partitions. Win-doze sees a drive but will not partition same. Linux sees the connect, but /dev/sdXX never gets created. Maybe it comes and goes, but there is nothing I can find.

    How do you access an empty hard drive out on a usb port?

  2. I have installed USB drive and created a single partition for data only. Everything seems to be working except my ability to move a file to the partition with a file name. Then I need the ability to extract that file or any file on the partition for the purpose of edit, then move back.

  3. Hi, I am a first time user on Ubuntu Linux and I am trying to format my USB Flash Drive. I am able to fdisk and type the format command mkfs.xxx /dev/sdb1 but then I get a long list of commands to choose from. I have no idae which one to choose. All I really want to do is format my USB, I want everything off.

    Please help. I honestly am lost.

    Thank you

  4. After a lot of deliberation I am finally getting off the procrastination and trying to migrate away from the MS arena; but even though the Linux crowd defend it so, I find the obscurity just as dark as windows. Upon reading this post I see other new users have run into the same problem I have and the time I have spent, together with the multiple Linux books leaves me still in the dark. Why is it so difficult to buy a sata drive, plug it into a usb port and set it up? Linux does not even detect it, or at least say “there’s something out there” – nothing. So I have to format it in the system I want to leave and then bring it to Linux just so it will acknowledge it. Oh and the wireless is just as difficult, WPA-personal allows for 16 characters in the text box to set it up, damn and my network was using 31 characters, break out the CAT5 and run the extensions down all the hallways “Its back to yesterdays technology!” – great.

Leave a Comment