Operating System - Linux
1820254 Members
2584 Online
109622 Solutions
New Discussion юеВ

getting erros when parted /dev/sda

 
Hanry Zhou
Super Advisor

getting erros when parted /dev/sda

Using /dev/sda
Error: Unable to open /dev/sda - unrecognised disk label.
Information: The operating system thinks the geometry on /dev/sda is 11/64/32.

I tried to "mklabel msdos" as suggested, but still the same, also tried "w" in fdisk, same.

Please advice,

Thanks,
none
11 REPLIES 11
Matti_Kurkela
Honored Contributor

Re: getting erros when parted /dev/sda

There might be some old garbage data at the beginning of the disk, which could cause the geometry to be detected wrong.

11/64/32 means the disk would be about 10 megabytes in size... if it's correct and it is not some kind of special equipment, think about sending it to a museum of ancient computers :-)

To remove the unrecognised disk label, you could try something like this:
dd if=/dev/zero of=/dev/sda bs=512 count=10

(DANGER: be very very sure /dev/sda is correct. This command will fill the beginning of the disk with zero bytes, overwriting the partition table/disk label. It will NOT warn you or ask "Are you sure?" if you point it to the wrong disk.)

After doing that, reboot and see if the disk geometry looks sensible now. The disk should now behave like it's never been used.
MK
Hanry Zhou
Super Advisor

Re: getting erros when parted /dev/sda

The error not just happent on /dev/sda, but also on /dev/sdb...h which has about 4G each, I believe

Using /dev/sdb
Error: Unable to open /dev/sdb - unrecognised disk label.
Information: The operating system thinks the geometry on /dev/sdb is
4401/255/63. Therefore, cylinder 1024 ends at 8032.499M.

I did "dd..." command as you suggested, but still got the same error. Do I have to reboot the server before I can get rid of the error?
none
Vitaly Karasik_1
Honored Contributor

Re: getting erros when parted /dev/sda

>when parted /dev/sda
are you speaking about "parted" utility? in this case may be make sense to try with "fdisk".
what do you see in /var/log/messages (regarding your harddisks)?)
Alan_152
Honored Contributor

Re: getting erros when parted /dev/sda

When I get this error, and it is on a drive that is not otherwise being used at the moment, I run a version of this script:

#!/bin/sh

function echoeval()
{
echo "${*}"
eval "${*}"
return $?
}

if [ -z "${*}" ] ;
then
echo "ERROR: no arguments specified"
exit -1
fi

if [ $# != 1 -o $1 == "--?" -o $1 == "--help" -o ! -e $1 ] ;
then
echo "Usage: $0 /dev/sdX"
echo "Summary: zap the first and last megabyte of a disk"
echo ""
echo "Use the cleandisk utility to remove all traces of a GPT style"
echo "partition table (hopefully). This script uses dd to remove the"
echo "tables, so it does not do a re-read of the partition table."
exit -1
fi

# Determine the point to seek to with dd for zapping the last megabyte.
off_t=`sfdisk -s $1`
(( off_t = off_t - 1024 ))

echo "Zap the first megabyte of the device."
echoeval "dd if=/dev/zero of=$1 bs=1k count=1024"
echo "Zap the last megabyte of the device."
echoeval "dd if=/dev/zero of=$1 bs=1k count=1024 seek=$off_t"

exit 0
Hanry Zhou
Super Advisor

Re: getting erros when parted /dev/sda

Your script could not solve the problem.
using fdisk get erros too.

What caused the problem, and what kind of problem it is anyway?
none
Alan_152
Honored Contributor

Re: getting erros when parted /dev/sda

My 1st inclination would be that if that script didn't work under linux, then the drive itself has issues. Did you at least get a valid answer for "sfdisk -s /dev/sda" ?

Alan_152
Honored Contributor

Re: getting erros when parted /dev/sda

You didn't mention what kind of hardware this was. Perhaps your BIOS is not detecting the drive properly...
Hanry Zhou
Super Advisor

Re: getting erros when parted /dev/sda

Yes.

sfdisk -s /dev/sda
11520
sfdisk -s /dev/sdb
35354880
...


Does that mean I have 35gb space on /dev/sdb?
What command I can tell what type of disks are they, and any commands I can use to check out if BIOS support this type of disks?

Thanks,

none
Hanry Zhou
Super Advisor

Re: getting erros when parted /dev/sda

I did "w" withing fdisk /dev/sdb, so now I am able to run parted /dev/sdb. However, if I want to run "print" after I starting parted, I am not able to, because the error /dev/sda. It seems I can not do anything within parted, unless I solve the error on /dev/sda first.
none
Colin Topliss
Esteemed Contributor

Re: getting erros when parted /dev/sda

Whats the output from:

fdisk -l /dev/sda

Knowing what your system config is would be useful. When you install a system, if it has internal SCSI disks you'd probably expect them to start with /dev/sda - so are these disks external ones? Are they SAN attached?

I have seen similar problems with SAN disks where they have previously been used by a Solaris system.....

Regards

Colin.
Alan_152
Honored Contributor

Re: getting erros when parted /dev/sda

sfdisk -s gives the size of the partition/drive in blocks. 11520 is too small for a modern physical device. You might want to use the -C, -H, and -S switches to namually define the cylinders, heads, and sectors, in case your kernel is really confused.