Formatting USB hard drives for Ubuntu (Gutsy Gibbon)

Recently my home Network Attached Storage (NAS) started acting flaky, so I wanted to back up my data. I picked up a 750 gigabyte Seagate Free Agent Pro drive. Here’s how I fixed a couple annoyances:

1. The drive is formatted with ntfs.

That’s great for Windows computers, but I preferred to format into a native Linux filesystem like ext3 or ext2. Rather than typing commands like mk2efs myself, I installed a wonderful utility called gparted. GParted lets you format and partition hard drives. Type the following:

sudo apt-get install gparted
sudo gparted

GParted is pretty intuitive, and it looks something like this:

Gparted screenshot

If you’ve just plugged your drive into the computer, unmount the drive by selecting the external drive (under GParted->Devices) and then doing Partition->Unmount. Then make sure the correct drive is selected (under GParted->Devices again). Once the right device is selected, click on the partition you want to format. You’ll see a dashed box appear around the partition that you clicked (see the picture above where “/dev/sdf1” has been clicked). Now click Partition->Format to . I recommend “ext3” because it’s a very stable file system. Finally, click “Apply” on the menu bar and just wait 3-4 minutes. GParted will do all the formatting for you.

2. Give the partition a label

It’s nice if you plug in an external hard drive and you see something more descriptive than “disk” or “usbdisk”. If you formatted the drive as ext3 in step 1, you can use e2label (from the e2fsprogs set of utilities) to give your drive a persistent name. Each time you plug in that drive, you’ll see the same label for that drive. Attach the USB drive to the computer and use the “mount” command to identify the partition to add a label to. Normally you’ll see something like “/media/disk” mapping to a device like “/dev/sdX” where X is a letter like a, b, or c. Suppose the disk partition that you want to label is /dev/sdf1 and you want to call the hard drive “M1”. Here’s how to do it:

sudo apt-get install e2fsprogs
sudo e2label /dev/sdf1
sudo e2label /dev/sdf1 “M1”
sudo e2label /dev/sdf1

The command “sudo e2label /dev/sdf1” will query /dev/sdf1 to see what label it has. If there is no label, you will get back a blank line. The above command makes the label be “M1”. The final command reads the label back. If everything worked correctly, the final command should return the word “M1”. I’d stick with a short and simple label (under 16 characters, and nothing fancy schmancy like punctuation/spaces).

3. The Seagate Free Agent Pro drive can spin down under Linux when you don’t want it to.

There’s a setting in the hard drive that you can easily modify with the “sdparm” program. Install sdparm with “sudo apt-get install sdparm”. Then imagine that your device is /dev/sdX (again, X will normally be a letter like ‘b’ or ‘c’). Here’s what I typed to see the setting and modify it:

sdparm -al /dev/sdX
sudo sdparm --clear STANDBY -6 /dev/sdX
sdparm -al /dev/sdX

You should see a line that looks like “STANDBY 1 [cha: y, def: 1, sav: 1] Standby timer active” change to “STANDBY 0 [cha: n, def: 1, sav: 0] Standby timer active“. If the drive has already spun down, you can unplug it, reboot everything, and plug it back in. Or the handy command “sudo sdparm --command=start /dev/sdX” might also wake it up.

The “-6” is a fallback for some older types of drives and I think it’s pretty safe to include on sdparm commands.

Further reading on how the Seagate Free Agent Pro spins down:

42 Responses to Formatting USB hard drives for Ubuntu (Gutsy Gibbon) (Leave a comment)

  1. Matt how about talking a bit about why Google is taking referral ads away from European publishers and only allowing them for US based publishers. I have websites that are based in the US, have most a US audience but now cannot show adsense referrals because I live in Ireland.

    What is going on? Or are you going to keep to the company line?

    Google have sent me an email to let me know of the decision but I cannot write back – it is no reply – come on, how hard is it to just let this run? When systems are set up already it must cost to take this away.

  2. @Leslie, Matt works in a completely different department.. he isn’t on the AdSense team.

    @Matt, I have always heard good things about Seagate. It’s sad to hear something like this come up. Hopefully they will give a response soon.

  3. Dear Leslie, Google always was taking referral ads away from European publishers. They are go now on different diretions / countries over the newasts European countries.

  4. I was considering getting a Seagate external hard drive also but may consider something else in light of some of the problems you are experiencing. Are there any other external hard drives you would recommend?

  5. If I recall correctly, you technically “should” be using `gksudo gparted` in part 1. Running graphical programs using sudo can be 100% fine, or it can cause all sorts of problems.

    Now, I would guess that it is likely that GParted wouldn’t do anything that could cause those problems, but it is a good practice to use gksudo for graphical applications. Additionally, you can make shortcuts (launchers?) using gksudo, while you have to run sudo from a terminal to see the password prompt.

    Thanks for the good reference regarding naming disks…

  6. Thanks for that Matt, It’s much easier than trying to remember all the command line parameters and what device my new usb dongle has been entered as.

    More of these Ubuntu tips please . . .

  7. Omar Yesid MariΓ±o

    Oh, nice post about Linux and other related subjects related, but I hope you write about Google and SEO again soon. πŸ™‚

  8. I understand your frustration, Leslie. I have a site in one of my spaces that’s flooded with spam right now. I have half a dozen sites pushing me down in the the SERPs and their tactics are so obvious it’s hard to believe (hundreds of links from sites on one IP, several times over).

    However, we have to acknowledge and appreciate that this is Matt’s personal blog. I know we all appreciate it when he spends his free time helping us, but honestly we aren’t entitled to it. If he want’s to talk about hard drives that’s his right.

    On that note, I just picked up a WD mybook (500GB) on newegg for $129 a couple weeks ago. Love it, and it’s my second one w/o problems.

  9. @Leslie – I think that you mis-read Google’s intention – it is only intending to remove referrals from your site to the Adsense product itself, referrals to other products will continue.
    See this post for more details –
    Cheers, Paul

  10. What happened to all the Googly posts you were making???? πŸ™

    we want more Google!!!

  11. Leslie, I have no idea. That’s on the ads side of the company and I haven’t talked to anyone involved in the decision. I’ve read a few posts where people said “get a disposable or one-time credit card and open up new AdWords accounts to get those sign-up bonuses!” So it’s possible that it was because of some type of abuse. But the short answer is that I wouldn’t give my speculation on the issue any more weight than any other person out on the web, because I don’t have any additional info/perspective on this issue.

  12. Tim Wintle, you warmed the cockles of my heart. πŸ™‚

    Gary R. Hess, you try to win them over your way (calling/emailing them). I’m going to try the backdoor approach: buy so many Seagate drives that I turn around and find that I’m a Seagate shareholder, then use that power to effect change in Seagate’s policies. I’m sure if I buy just 1-2 more drives… πŸ˜‰

    Jonathan, I’ll circle back around to Google posts in a bit, but with the holiday season I got a pent-up desire to talk about gadgets a little more. Maybe it’s Macworld in the air.

  13. there is a ton of info on how linux’s handle spin down on the Nslu2 linux pages which is running about running various linux distributions on the linksys nslu2.

  14. Hey Matt,

    Thanks for the Linux post. I had to look at Wikipedia to realize that Ubuntu is an operating system which is a primarily desktop focused version of Linux. (assuming I understood correctly πŸ™‚

    I am looking at new machines, with this strange far off dream of eventually being able to be M.S. Windows free some day. What is Linux like for those with less coding skill to use? How would it work in an office enviroment where most of the people have no programming experience and are regular M.S. windows users?


  15. Matt, I love that you broke up my monotonous SEO reading with some Ubuntu love. My only question — Why not Fiesty? I’m running 7.10 on my old Dell Inspiron as well as my main production and blogging PC at home.

    I’m new to *nix, but after playing around with gOS a bit, I needed something more gritty — and Ubuntu seems the best fit for me of the major releases. I liked Core 8, but found it to be more of a dog on my gear.

    Take care!
    – Eric

  16. dk — Ubuntu is wonderful. I hooked my mother up with a machine to use (she still thinks AOL *is* the Internet) and it held her down and kept her productive for more than two weeks. With OpenOffice, it’s wonderfully easy. Besides, there’s always Google Documents!

    The easiest way to do it up would be to add a secondary HD to your machine and use that for your chosen distribution for Linux. From there, you can learn and still play around while remaining productive with a Windows box.

  17. Is Ubuntu that great?
    I have been wondering for a long time whether to get it or not.
    I currently have Dell Inspiron 1100 with 2.4 Ghz Intel Celeron Processor and 512 MB of Memory.
    I have about 30 Gb of storage with about only 9 GB free.
    I mostly use General Office Application Word, Excel and Powerpoint, Dreamweaver, MSN, Yahoo and Google Chat, itunes, and Real Media, and Firefox and Thunderbird. With all these applications, my computer is running very slow. I am wondering whether Ubuntu would make the operation faster! Any info would be great.
    Thanks for opening the Linux chapter Matt!

  18. Dave (original)

    More RAM would be my 1st thought. Now-a-days 1GB of RAM is often the min needed.

  19. Dear Mat,
    I have been struggling with a portable USB HDD for the past two days and I happened to see your very informative post. I installed gparted but still it does not work. What I really want to do is format the disk.
    When I first attach the disk, (I am using using Ubuntu 7.10) it gives an error saying “Cannot mount volume”. However, like with any other well behaving external disk or a CD/DVD, it does open the file browser page to show that this disk has no data. In gparted, the menu option of ‘Partition’ does not show any of the submenus highlighted (resize/delete, format to, etc.)
    What could be the problem? Please help !
    Pune, India

  20. Thanks Matt and everyone for the replies – I did not mean to sound like you should not be talking about what you want here – I read here because it is useful and you write well.


  21. hardward…yikes!

    Matt I have a question. I know its off topic but I would appreciate your response. How come google sometimes divides the SERP into multiple categories? what does that mean?

    For example if you type in Soccer Nation in google, you will see what I mean.

  22. @Dr. David Kline

    I’m a longtime MS OS user (back to the MSDOS 2.x days) but I’ve enjoyed piddling around with various “flavours” of Linux this past year or so. The best advice one can give you is to download and burn a few “LiveCD” distributions. Just insert the LiveCD, reboot, and the whole OS will boot off the CD, leaving your Windows installation intact and untouched. The ordinary Ubuntu disk allows you to play around with the LiveCD while you’re installing the OS which gives you a bit of time to acclimatize to it in the mean time.

    In truth, my own experience with Ubuntu (the last version I tried was Feisty Fawn – currently the next-to-newest release) was quite poor. I had some difficulty getting my hardware drivers installed and found it very frustrating to filter through the reams of user forums and FAQs that pertained to my hardware but for the wrong version of Linux. Also, I’m an avid gamer and most of my favourite software didn’t run properly or at all in Linux. Supposedly one can run MS Office just fine in Linux though I didn’t try.

    I think Linux and specifically Ubuntu are getting to be very user-friendly, and they’ve already got more intuitive user interfaces than any other OS (I can’t wait to try the new KDE 4.0), but the window dressing is often only skin-deep. Many applications are much more complex and featureful than their watered-down UI allows, forcing users to delve into the scary command line. There’s somewhere between a plethora and cornucopia of free apps, but honestly I prefer the freeware on Windows.

    Going 100% open source is a noble and extremely educational endeavour and I wish you luck. Give it a try, be patient, and have fun – it’s very rewarding. However, as “they” say, Linux is free if your time is worthless.

  23. Now, thats saying something Brian.
    I will just reformat my ol’ PC and then get meself a new fancy hp tx1000z.
    Boo me as you all may!?!?!
    What about that dandy MacBook Air? Hardly a prize winner in my book.

  24. dk, Rob – Ubuntu is great.

    I’ve use Fedora Linux for as long as it has been around, and Red-hat Linux before that, but Ubuntu won me over recently as it’s so simple to use.

    As with all Linux distributions there can be some problems with hardware (if the manufacturer doesn’t stick to standards and refuses to tell open source developers how to create drivers), but most things work without a hitch these days.

    Rob, you said you use:
    Word, Excel and Powerpoint, Dreamweaver, MSN, Yahoo and Google Chat, itunes, and Real Media, and Firefox and Thunderbird.

    Ubuntu has:
    Word -> open office
    Excel -> open office
    Powerpoint -> open office
    Dreamweaver -> ? (I use bluefish, but I think you can run dreamweaver with WINE)
    MSN -> Pidgin Internet Messenger (connects to msn)
    itunes -> Rhythmbox (almost identical, but without the shopping)

    and it has firefox and thunderbird (although I recommend Evolution over thunderbird).

    Don’t know about real media, you can play real media, but I don’t know how to encode it.

    For any of these things Linux is IMO easier to use than Vista or OSX, and it can be better looking, but for more technical things you need to start editing text file configuration settings. If you’re a standard computer user I would recommend Ubuntu.

    There is also great support for ubuntu: see

  25. This spam protector math is so hard!?!?!

    Thank you very much for the encouragement Tim and all the info. I will definitely try it once I have a new PC. As they say, don’t put all eggs in one basket!

  26. What a coincedence, I have the 1TB Seagate and I’m using it on my old laptop running Ubuntu (Edgy because it supports my wi-fi card). I have it setup to do daily backups of my production and client databases from my dedicated servers (which are running RHEL). Ubuntu is, in my opinion, the best flavour of Linux for the desktop user but I swear by RHEL for production servers.

  27. Hey
    IMO Ubunto it’s great OS
    I’m not fan of Linux, I’m just WinXP user like most of other people
    But few days ago i start my adventure with Ubuntu πŸ™‚
    Installation of this OS are soooo easy,
    and during install Ubuntu we are connectet to Internet and we can surf πŸ˜‰
    It’s much better then win installations….
    The second matter is that after install Ubuntu on my notebook I have almost complete instalation (all drivers was instaled… I was must install only Nvidia diver)

    So , I want say, Ubuntu rlz πŸ˜‰ win sux πŸ˜‰
    /sry for my english.. I just start learning this language πŸ˜‰ /

  28. How can sites crawled by google request to stay in google results but also request you do not share there site information with anyone else without possibility of any penaly in SERPS or otherwise?

  29. The object in picture – ” no idea and not interested ”

    What I would be interested in is making basic seo available to the newcommers in this age of spam wouldn’t it do well to do some good to help people that are new with new ideas or do you guys just wanna promote spammy crap that pays you the money?

  30. I bought a lap top from Packard Bell only for it to have problem after problem and even though it was still under warranty (at the time) they did nothing to help me out. So I gave up on it as it was going to cost too much for a new cpu and hard disk than it was worth.

    A mate of mine had a look at it and said to install Linux on it as it didn’t need to resources that windows required, now I have another computer back thanks to the greatest of Ubuntu, I would recommend it to anyone for normal internet use, I now use Mac but it is a great little back up and as others have said there are plenty of great open source programs for Ubuntu.

    And version 7.10 skin looks a little like Mac! A cheap way around having something that looks like Mac without the greatness of Mac!

    I have now starting converting windows users that have bought brand new computers with Vista to Ubuntu.

  31. Matt,

    Thank you much for your help in turning off the STANDBY feature on the Seagate Free Agent Pro. I have a series of cron tasks that are supposed to routinely back up my data to a Seagate, and the spin down was a horrible nuisance.

    On the other hand, I’m still pretty ignorant when it comes to hardware. Will disabling the IDLE and STANDBY options shorten the drive’s life significantly?


  32. Hi Matt,

    Thanks for this tip. Both the qparted tip and the 32label worked for me. The only thing I would add is that the user is going to need to change the permissions on the external hard drive to their user account if they are using Hardy, because Hardy set the ownership of my Iomega external hard drive as root. Some end users might not think of that. The symptom that I was experiencing was trouble writing to the external hard drive.

    Thanks again, Matt!

    Christian Einfeldt,
    Producer, The Digital Tipping Point

  33. Christian is right. I can’t make new folders etc because owner is root. How do I change owner so I can set permissions. Will I be able to use this same portable hard drive on different computers? Thanks.

  34. At first, thank you Matt for the tips!

    However, I report that after formatting the USB drive to ext3, naming and sdparming it, I wasn’t able to boot anymore. What I got was just error 15 in grub. And I’m 100% sure that I did not touch any other devices than the Seagate USB drive while performing these steps. The Ubuntu version I use is 8.04.

    I have followed these advices to solve the problem. Basically just for fun since my plan was to install Ubuntu 8.10 after taking backups. And luckily, I took full backup before shutting down the machine yesterday night.

    But in any case, it would be nice to understand what happened.

  35. Thank you so much for the concise instructions on how to format my WD external hard drive. After a day of frustration dealing with ‘puter issues, including trying to understand why I couldn’t copy any files bigger than 4G to the WD disk, it was like a breath of fresh air to find something that worked, first try!

  36. All right guys,

    This is what i did and it works

    I have an Iomega external Hard Drive (HD USB) 250 GB
    I downloaded “GPARTED” then it identified my Iomega HD
    Then I rightcliced it and UNMOUNT it That’s necessary for the formatting
    Finally rightcliced again and select format to FAT32 that’s the needed one format
    This FAT32 allow you to write and read it.

    And it works with Ubuntu and
    Windows and I supose to MAc OS X too
    So that is it
    Remember to make a BACK UP first with DVDS or another Computer or HD

  37. Harrison Napper

    Ditto on the Ubuntu appreciation. Kind of late to the party, I realize, but for what it’s worth, I run Ubuntu Studio 9.04 (Jaunty Jackalope) and I believe GParted comes standard with the OS in the Admin tools. As a Linux n00b, I can attest to the fact that Ubuntu is pretty easy for non-coders (though I do know how to program a little bit, if I didn’t, I would still be fine with a little effort and ingenuity) and this tutorial is still applicable on 9.04. One difference being, of course, that most of the command line work can be bypassed for the GUI if you prefer that route. If you are going to run a production studio environment, formatting your external hard-drives is essentially a must. Thanks and keep up the informative posts!


  38. I have just gone through the process of launching a reviews and guides website. I read and wrote reviews on over 50 usb portable drives including several about the necessity of backup.

    I have 2 Seagate USB portable drives on my system and yes, my Cand D drives are backed up. I am ashamed to say the backup is at least 6 months old. I need to practice what I preach. I am thinking of either getting a Seagate Free Agent Xtreme or a Western Digital MyBook Mirror.

    Incase you aren’t familiar with teh WD Mirror, it contains 2 drives. You can either configure them in RAID 0 and have 1 humongous drive or RAID 1 and have an auto backed up drive.

    Right now, I am leaning toward the WD MyBook Mirror. Any thoughts?

  39. Matt, on a similar note: I recently went to Ubuntu 9.10 Karmic Koala from XP, and I have a 1TB Western Digital external formatted with NTFS. my problem is, I cannot edit/move some of my files because NTFS and Linux do not play nice, at least that is what I have been hearing on the forums I have been looking at…my real problem is, I do not have another HD to put my 800 gigs of Music/Movies/pictures/documents/installers on in order to format to ext2/3 etc. any pointers/tips on how to fix this?

    -Thank you in advance,


    • John, if you’ve got 800 gigs of documents, you really should get another hard drive, at least to back all that stuff up. You’re just one hard drive failure away from some really unhappy times..

  40. This was immensely helpful. Thanks.

  41. Here is a command line method to format a usb in linux