LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-16-2006, 02:13 PM   #1
robbbert
Member
 
Registered: Oct 2005
Location: Hannover, Germany
Distribution: Let there be Ubuntu... :o)
Posts: 573

Rep: Reputation: 32
How to format a partition on an external USB drive


Hi, I'm trying to use gparted to format a partition on an external HDD, connected via USB.

This HDD is divided into a number of NTFS and ext3 partitions and also contains a boot sector. This is on Ubuntu 6.06 if it makes a difference.

OK, I plug-in the device and the contents will show up under /media/usbdisk, /media/usbdisk-1, etc.
I open GPartEd and choose /dev/sdc from the combobox. GPartEd then will list the partitions as /dev/sdc1, /dev/sdc2, etc.
Now, in order to format one of the partitions (an NTFS one), I unmount it first. GPartEd will throw loads of warnings and errors to the standard output:
Code:
Warning: Unable to open /dev/hdc read-write (Read-only file system).  /dev/hdc has been opened read-only.
Error: Unable to open /dev/hdc - unrecognised disk label.
Error reading inode 701.
Error reading inode 1332.
Error reading inode 1531.
Error reading inode 1642.
Error reading inode 1677.
...
...
Couldn't read MFT Record 55547: Input/output error.
Error: Error opening /dev/sdc: No such device or address
Warning: Unable to open /dev/hdc read-write (Read-only file system).  /dev/hdc has been opened read-only.
Error: Unable to open /dev/hdc - unrecognised disk label.
Next, GPartEd will popup a messagebox:
Code:
The kernel is unable to re-read the partitiontables on the following devices:
- /dev/sdc

Because of this you will only have limited access to these devices.
Unmount all mounted partitions on a device to get full access.
There is no file /dev/hdc, and also /dev/sdc* do not exist, BTW.

Could someone kindly tell me what's going on.
Thanks
 
Old 08-16-2006, 04:41 PM   #2
ilpadrino
Member
 
Registered: Oct 2003
Location: Spain
Distribution: Fedora
Posts: 104

Rep: Reputation: 15
I think you better try fdisk which, in my opinion, is the best partitioon tool avalaible. First of all type "dmesg" just after plugging the device to check which is the assigned drive (e.g: sdc: sdc1, sdc2). Then use fdisk /dev/sdc. Press "d" to delete the existing partitions (first number "1"), press "d" again and then press "2" to delete the second partition. Once you have finished, type "w" to write changes to the disk. Then restart fdisk /dev/sdc, press "n" to create a new partition, press "1" to number the first partition, then press "p" to create a primary partition and finally assign the size you wish to this partition. Repeat this process for the second partition pressing "2" instead of "1". Press "t" to change the partition identification, as linux by default assign ext3 type to all the new partitions created. Then press "w" to exit saving changes to the disk and you will have your partitions ready to be formated. Afterwards, use mkfs -t ext3 /dev/sdc1 to format the first (Linux) partition. The second one must be formated under Windows due to Linux is unable to format ntfs filesystem type.

PD: HDC seems to be the cdrom drive under your system.

Good luck

Last edited by ilpadrino; 08-16-2006 at 04:44 PM.
 
Old 08-16-2006, 05:43 PM   #3
robbbert
Member
 
Registered: Oct 2005
Location: Hannover, Germany
Distribution: Let there be Ubuntu... :o)
Posts: 573

Original Poster
Rep: Reputation: 32
Thanks!

The last relevant output of dmesg is:
Code:
[17193081.728000] usb 2-2.1: new full speed USB device using uhci_hcd and address 45
[17193081.832000] scsi5 : SCSI emulation for USB Mass Storage devices
[17193081.832000] usb-storage: device found at 45
[17193081.832000] usb-storage: waiting for device to settle before scanning
[17193086.868000]   Vendor: SAMSUNG   Model: MP0804H           Rev: UE10
[17193086.868000]   Type:   Direct-Access                      ANSI SCSI revision: 00
[17193086.872000] SCSI device sde: 156368015 512-byte hdwr sectors (80060 MB)
[17193086.872000] sde: assuming drive cache: write through
[17193086.876000] SCSI device sde: 156368015 512-byte hdwr sectors (80060 MB)
[17193086.876000] sde: assuming drive cache: write through
[17193086.876000]  sde: sde1 sde2 < sde5 > sde3
[17193087.376000] sd 5:0:0:0: Attached scsi disk sde
[17193087.376000] sd 5:0:0:0: Attached scsi generic sg0 type 0
[17193087.376000] usb-storage: device scan complete
[17193088.948000] printk: 9 messages suppressed.
[17193088.948000] NTFS-fs warning (device sde1): parse_options(): Option iocharset is deprecated. Please use option nls=<charsetname> in the future.
[17193089.592000] NTFS volume version 3.1.
[17193089.744000] NTFS-fs warning (device sde5): parse_options(): Option iocharset is deprecated. Please use option nls=<charsetname> in the future.
[17193089.980000] NTFS volume version 3.1.
[17193090.232000]  1:0:0:0: rejecting I/O to dead device
[17193090.232000] EXT3-fs error (device sdb3): ext3_readdir: directory #2 contains a hole at offset 0
[17193090.232000]  2:0:0:0: rejecting I/O to dead device
[17193090.232000] EXT3-fs error (device sdc3): ext3_readdir: directory #2 contains a hole at offset 0
[17193090.232000]  3:0:0:0: rejecting I/O to dead device
[17193090.232000] EXT3-fs error (device sdd3): ext3_readdir: directory #2 contains a hole at offset 0
[17193090.232000]  3:0:0:0: rejecting I/O to dead device
[17193090.232000] Buffer I/O error on device sdd3, logical block 0
[17193090.232000] lost page write due to I/O error on sdd3
[17193090.232000] ext3_abort called.
[17193090.232000] EXT3-fs error (device sdd3): ext3_journal_start_sb: Detected aborted journal
[17193090.232000] Remounting filesystem read-only
[17193090.608000] kjournald starting.  Commit interval 5 seconds
[17193090.620000] EXT3 FS on sde3, internal journal
[17193090.620000] EXT3-fs: recovery complete.
[17193090.624000] EXT3-fs: mounted filesystem with ordered data mode.
Nevertheless, the file manager (Nautilus) displays the contents of the partitions well, and any file I've opened from there until now has opened without any problems.
Quote:
Then use fdisk /dev/sdc
It will return:
Code:
Unable to open /dev/sdc
I've also tried /dev/sdb and /dev/sdd, getting the same result.

Thanks again. It's, I don't have the knowledge how to interprete these messages. I would be willing to read some manuals, if necessary. - Most important now is, I don't know the next step.
 
Old 08-17-2006, 04:29 AM   #4
ilpadrino
Member
 
Registered: Oct 2003
Location: Spain
Distribution: Fedora
Posts: 104

Rep: Reputation: 15
You can see here that your drive is assigneed as /dev/sde.

Quote:
SCSI device sde: 156368015 512-byte hdwr sectors (80060 MB)
[17193086.872000] sde: assuming drive cache: write through
[17193086.876000] SCSI device sde: 156368015 512-byte hdwr sectors (80060 MB)
[17193086.876000] sde: assuming drive cache: write through
[17193086.876000] sde: sde1 sde2 < sde5 > sde3
As I can see, you have four partition in your drive (numbered 1,2,5,3), which two of them(1 and 5) are ntfs filesystem. Nautilus mount them so you can see the contents. So if you want to fomat them, you have to type mkfs -t ext3 /dev/sde2&&mkfs -t ext3 /dev/sde3, in case you want to have two Linux partition and also want to mantain four partition in the disk. If not, delete all partition as I have posted before, plug the disk just after booting, type dmesg and post the result. I will then post exactly what you have to do.

Regards
 
Old 08-17-2006, 08:15 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,465

Rep: Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218Reputation: 6218
FYI
/dev/sde2 is an extended partition and this can not be formatted with a filesystem. In a nutshell it is a container for logical partitions i.e. sda5 in your case. Your data partitions are 1,3 & 5.
 
Old 08-17-2006, 12:04 PM   #6
Toxyn
LQ Newbie
 
Registered: Jan 2006
Posts: 17

Rep: Reputation: 0
I am guessing your USB drive is a standard ide/sata drive in a USB 'cradle'? if so, why not try taking the drive out of the usb device and attaching it to your pc, formatting it as you wish, then putting it back into the usb device?
 
Old 08-17-2006, 02:21 PM   #7
robbbert
Member
 
Registered: Oct 2005
Location: Hannover, Germany
Distribution: Let there be Ubuntu... :o)
Posts: 573

Original Poster
Rep: Reputation: 32
It worked, thank you, indeed!

Here's what I did: Plugged in the device, and then
Code:
mount
to identify which /dev/sd?[n] partition had been mapped to which /media/* mount point. - Then:
Code:
sudo umount /dev/sdc1
and then
Code:
sudo mkfs -t vfat /dev/sdc1
Plugged-in the drive again, et voila, the new filesystem! Really cool!

- Toxyn, this is a 2.5" external drive, being used from a standard PC. Also, directly connecting to it (not via USB) wouldn't actually improve anything (but access speed), I guess?
 
Old 08-17-2006, 02:39 PM   #8
ilpadrino
Member
 
Registered: Oct 2003
Location: Spain
Distribution: Fedora
Posts: 104

Rep: Reputation: 15
Michaelk is OK. Sorry for the mistake
 
Old 08-17-2006, 03:31 PM   #9
robbbert
Member
 
Registered: Oct 2005
Location: Hannover, Germany
Distribution: Let there be Ubuntu... :o)
Posts: 573

Original Poster
Rep: Reputation: 32
Thank you very much, ilpadrino. Even if you were wrong in details, you've saved me loads of time by providing me with the commands I needed. I would not be able to use Linux efficiently if there were not users like you who help me to get started. Your posting has been most helpful to me.

michaelk's posting has been helpful to me as I looked at the file system / mount point mappings more thoroughly.

- To me, personally, this thread is a full success! Teamwork in a way

Thanks all!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ext3 partition on external USB hard drive mounted, but only root access allowed leontini Linux - Hardware 4 02-17-2006 02:54 AM
how to mount a external hard drive in ext3 format? kuertensun Linux - Newbie 12 09-06-2005 07:51 PM
partition and format unpartitioned hard disk which lies on an external usb case odysseus.lost Linux - General 1 08-09-2005 07:03 PM
howto boot Suse 9.1 from external usb drive through bios-accessable boot partition McHenner Linux - Hardware 2 09-30-2004 08:27 AM
format an external scsi drive on linux Doyle Linux - Hardware 1 11-19-2003 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration