Wednesday 16 May 2007

How (not) to partition an external hdd on Linux

I've bought a chiliGREEN external HDD with USB 2.0 interface, and I would like to share some experiences with making it work on Linux (Ubuntu Edgy).

After connecting it to an USB 2.0 port, the disk was correctly recognized as /dev/sda, and a nautilus window opened showing the contents of the preformatted NTFS partition. It was all smooth and fine, but I wanted to do some serious stuff with that drive, eg. keeping backups with symbolic liks preserved, and felt as if NTFS is not exactly the right filesystem for me.

Thus I invoked fdisk to repartition the hard drive. I made one 80Gb Linux partition (/dev/sda1) for normal use and one 40Gb windows partition (/dev/sda2), just in case.

$ fdisk /dev/sda
  d,1
  n,p,1
  n,p,2
  t,1,83
  t,2,7
  p
  q

Then I tried to format /dev/sda1. However, I've made a mistake: I've invoked both mkfs.ext3 and fdisk without root permissions. I have started relying on sudo only recently (2 years, time flies when you've got little children), so I forgot both options, either to become a superuser or to simply say sudo in front of fdisk. I mean, I was formatting disks, one would thought that the computer would recognize a need for becoming root :-)

$ mkfs.ext3 /dev/sda1
It went fine in the beginning, but in the end I've received a most disturbing error message:
ext2fs_mkdir: Attempt to read block from filesystem resulted in short read while creating root dir
After that, the drive become invisible to the system:
$ fdisk /dev/sda
Unable to open /dev/sda

I've browsed the internet for the error, and found no clues for solving the problem (only open questions). I've re-attached the drive and tried with a different tool. I again forgot to become superuser :-), but parted warned me:

$ parted /dev/sda
WARNING: You are not superuser.  Watch out for permissions.
So I did the right thing:
$ sudo parted /dev/sda
Then I did simply:
(parted) mkfs 1 ext2                                                      
(parted) mkfs 2 fat32                                                     
And then everything started to function just fine.

The conclusion? Either fdisk or mkfs.ext3 messed up the because it was invoked without root privileges. This should be fixed in my opinion. I post this so that other people when encountering this same message might read about my experience and hopefully avoid a few hours of frustration.

4 comments:

Eduardo said...

As I understood you manage quite all right the Linux, that is not my case. Let me put this, my external driver keeps telling me it can not be mounted. Although once it was indeed mounted. Using the desktop instructions on the console it does not work either. Does anybody has any hints to help this Linux newcomer.

Eduardo

Anonymous said...

I've been being frustrated by a set of 1TB disks for a while now. Two work just fine, two don't want to know me. One is not visible when I plug it in, the other is, but requires formatting. But after failed formatting I get the disk disappearing act that you mention. I'm going to try swapping cases around, but it really sounds like a disk issue.
I get exactly the same error as you, about the short read while creating root dir; however I'm already using sudo (always do!), and it's still happening. I'm not suggesting you might have the answer, I just thought I'd let you know that 'sudo' might not be the key.

Cheers.

gangbang rape stories said...

Moto sighed, and rocked back in his chair, surrendering himself up to the heavenly feel of the lovely wet lips of this charmingly submissive woman who knelt before him, dutifully kissing her masters feet. He had seduced her with rumors and salacious gossipand one fine day while they were sitting at the parkshe had shyly invited him home for evening tea andcupcakes.
wife sex with dog stories
erotic uncles huge cock stories
men masturbation stories
free erotic short stories
alt sex stories
Moto sighed, and rocked back in his chair, surrendering himself up to the heavenly feel of the lovely wet lips of this charmingly submissive woman who knelt before him, dutifully kissing her masters feet. He had seduced her with rumors and salacious gossipand one fine day while they were sitting at the parkshe had shyly invited him home for evening tea andcupcakes.

Anonymous said...

top [url=http://www.001casino.com/]free casino[/url] check the latest [url=http://www.casinolasvegass.com/]casino games[/url] manumitted no store reward at the chief [url=http://www.baywatchcasino.com/]online casino
[/url].