Linux format external USB hard disk Partition

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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 15 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
15 comments… add one
  • rocky Mar 16, 2007 @ 8:43

    Thanks a lot

  • norman Mar 27, 2007 @ 10:31

    I have put ubuntu onto a hard drive and would like to know if I could format it so I can use windows xp
    most obliged

  • Dan Saint-Andre Aug 7, 2007 @ 17:40

    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?

  • lewis lipkin Aug 27, 2007 @ 20:46

    Have you received any replies to your query?
    If so can you pass on the solution.

    Lew Lipkin

  • kasi Sep 26, 2007 @ 11:49

    I had a usb drive it was detecting under linux and windows ,but after some time it was not detected under windows, now i want to format the usb under knopix linux

  • Allen Apr 27, 2009 @ 2:32

    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.

  • Vadim Motorine Aug 5, 2009 @ 13:39

    Thanks a lot. It indeed works.

  • Mandy Feb 16, 2010 @ 17:09

    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 /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

  • Blerim Feb 22, 2010 @ 16:06

    Hi,can someone tell me how to install two OS (first Linux is installed) now Windows,but my laptop dosnt have DVD-ROM?

  • charlie maaere Feb 28, 2010 @ 12:37

    hey guys, to format a USB, Flash drive in Linux there is graphical tool created check this link


  • OhHenree Mar 4, 2010 @ 18:54

    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.

  • Manshell Jul 20, 2010 @ 16:43

    Hi, i installed Ubuntu in my external Hardisk and now i want to format it so the disk can be fully empty. How can i do it?
    Thanks in advanced

  • another Sep 20, 2010 @ 19:56

    mkntfs -Q -v -L “DISKLABEL” /dev/sdc1

  • PitaJé Dec 19, 2010 @ 22:43

    In ubuntu, you can use gparted to manage disk partitions via a gui.

    # sudo apt-get install gparted

  • swetha Jan 11, 2011 @ 6:45

    If a new hard disk is given to you what are the commands you use in
    order to make partition & format the hard disk in linux

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum