Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The error you are seeing, "Medium Error", means that the surface of the disk has been damaged. This usually happens when moving the drive while it's powered up and spinning.
You can try wiping the information, repartitioning and reformatting with a read/write bad block remap (the '-c -c' option), but it may not be possible depending on the extent of the damage:
Code:
# Wipe the label, partition table, LVM2 and MD areas
dd if=/dev/zero of=/dev/sda bs=512 count=64
# Repartition to create /dev/sda1
fdisk /dev/sda
# Reformat and map out bad blocks
mke2fs -c -c -j -m0 /dev/sda1
The error you are seeing, "Medium Error", means that the surface of the disk has been damaged. This usually happens when moving the drive while it's powered up and spinning.
You can try wiping the information, repartitioning and reformatting with a read/write bad block remap (the '-c -c' option), but it may not be possible depending on the extent of the damage:
Code:
# Wipe the label, partition table, LVM2 and MD areas
dd if=/dev/zero of=/dev/sda bs=512 count=64
# Repartition to create /dev/sda1
fdisk /dev/sda
# Reformat and map out bad blocks
mke2fs -c -c -j -m0 /dev/sda1
When I type
Code:
fdisk /dev/sda
I see this message:
Code:
luini:~# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
You must set cylinders.
You can do this from the extra functions menu.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):
The command 'man fdisk' will have some help, but notice the "Command (m for help):".
Code:
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
You want to create a new primary partition, and write the partition table to the drive:
Code:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-xxxxxx, default 1): <just hit enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-xxxxxx, default xxxxxx): <just hit enter>
Using default value xxxxxx
Command (m for help): w
Last edited by macemoneta; 09-16-2007 at 07:06 AM.
The command 'man fdisk' will have some help, but notice the "Command (m for help):".
Code:
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
You want to create a new primary partition, and write the partition table to the drive:
Code:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-xxxxxx, default 1): <just hit enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-xxxxxx, default xxxxxx): <just hit enter>
Using default value xxxxxx
Command (m for help): w
If I type "n" , I see:
Code:
Command (m for help): n
You must set cylinders.
You can do this from the extra functions menu.
This means that the drive has lost the basic geometry information. You will need to open the external drive case, and examine the disk drive inside. The physical cylinders, heads, sectors are printed on the label on the drive. Once you have this information you enter it via:
Code:
Command (m for help): x
Expert command (m for help): s
Number of sectors (1-63): <enter the value from the label>
Expert command (m for help): h
Number of heads (1-256): <enter the value from the label>
Expert command (m for help): c
Number of cylinders (1-131071): <enter the value from the label>
Expert command (m for help): r
This means that the drive has lost the basic geometry information. You will need to open the external drive case, and examine the disk drive inside. The physical cylinders, heads, sectors are printed on the label on the drive. Once you have this information you enter it via:
Code:
Command (m for help): x
Expert command (m for help): s
Number of sectors (1-63): <enter the value from the label>
Expert command (m for help): h
Number of heads (1-256): <enter the value from the label>
Expert command (m for help): c
Number of cylinders (1-131071): <enter the value from the label>
Expert command (m for help): r
ok.
Because of I can't open box. I've found on google this values:
Maybe. Manufacturers change drives without changing the model. You can try it. If the values are wrong, the drive will either appear smaller/larger than it should be, or the format will fail trying to write to non-existing areas.
Expert command (m for help): c
Number of cylinders (1-1048576): 19457
The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Expert command (m for help): h
Number of heads (1-256, default 255):
Using default value 255
Expert command (m for help): s
Number of sectors (1-63, default 63):
Using default value 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 25: Inappropriate ioctl for device.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
I hate to complicate things, but the error message could also point to a failed controller, which in this case would most likely be the interface between the drive and the USB.
I'd be looking at this possibility before trying to go too far with that drive.
Given that the basic geometry info isn't being retrieved, I would actually assign the likelihood of a controller failure ahead of a drive failure; it is rare for any kind of drive failure that is short of total to result in the loss of geometry info, but this would be an expected response from a failed controller.
volleyboy: Did you create the partition before attempting to write? If not, you didn't write anything, and reading the partition information will then fail.
jiml8: Yup, but I'm pursuing the optimistic path that the drive media has a correctable error. If it turns out that's not the case, then hardware has to be replaced, either incrementally (drive, case/interface) or all together.
jiml8: Yup, but I'm pursuing the optimistic path that the drive media has a correctable error. If it turns out that's not the case, then hardware has to be replaced, either incrementally (drive, case/interface) or all together.
I would label that a pessimistic case, in that you are following a path that will result in all the data on the drive being lost. While this might not be a big deal since the drive has only been in use a month, it is never a good thing.
I would say that the first thing to do is remove the drive from the housing, plug it into a computer, and see if it can be read from there. This has the advantage of immediately ruling in or ruling out the controller, and if the controller is identified as the problem it makes it possible to immediately access the data.
Further, by directly plugging the drive into a computer, tools that don't work via USB (hdparm) can be used.
jiml8: Read post #7. What you or I might do isn't necessarily an option. If you'd like to attempt the walk-through, I'll defer to you.
Can't open box??? Oh well!
Reminds me of a joke.
The blonde was on her hands and knees, searching the floor closely. A fellow comes along, sees her peering at the floor and asks: "what did you lose? Can I help you find it?"
She responds: "Yes, I lost a contact lens over there (points across the room), and I am trying to find it."
"If you lost the lens over there, why are you searching for it here?"
"Because the light is better here"
Should the controller be at fault (and all the symptoms/diagnosis to this point sure suggests that) then not opening the box = not fixing the problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.