Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: What number is a cyl boundry?

24 views
Skip to first unread message

Allen Kistler

unread,
Aug 20, 2006, 11:21:01 PM8/20/06
to
ANC wrote:
> Allen Kistler wrote:
>
>> ANC wrote:
>> --- paste ---
>> Disk /dev/sda: 80.0 GB, 80026361856 bytes
>> 255 heads, 63 sectors/track, 9729 cylinders
>> Units = cylinders of 16065 * 512 = 8225280 bytes
>>
>> Device Boot Start End Blocks Id System
>> /dev/sda1 * 1 5264 42282268 7 HPFS/NTFS
>> Partition 1 does not end on cylinder boundary.
>> /dev/sda2 5265 6830 12578895 83 Linux
>> --- end paste ---
>>> Above are fdisk stats.
>>>
>>> Can anyone tell me how to fix sda1 so it ends on a cyl boundry? I know I
>>> need to resize it (yes I know risks) but I don't know what to resize it
>>> TO!
>> Even Windows ends partitions on cylinder boundaries, so the problem is
>> really that Windows and Linux appear to be translating the disk
>> differently. If you value each OS on the same disk, you need to get
>> them to see the same geometry before you do anything else.
>
> Ok, how do I do that?
>
> [snip]
>
> This all happened when I used QTparted to shrink Windows ...

So after a pause, the truth comes out. QtParted toasted Windows and you
want to get it back. You should post with that subject. You'll get
more accurate and on-topic responses.

To get the data off the disk, try putting it in another Windows machine.
I doubt you'll be more successful than with Linux, but it's worth a shot.

You can try deleting the partition and recreating it. I doubt that will
work, but it's worth a shot. Mostly I think you'll have to delete the
partition, recreate it, then reinstall Windows. Then reinstall grub.

But back to my first point, if you post with the correct info, you may
find someone who's had exactly the same thing happen to them with
Windows and QtParted. They may have even recovered and can tell you how
they did it.

FWIW my understanding is that QtParted uses an external tool, usually
from linux-ntfs.org.

Douglas Mayne

unread,
Aug 21, 2006, 12:37:33 AM8/21/06
to
On Mon, 21 Aug 2006 02:29:34 +0000, ANC wrote:

> Allen Kistler wrote:
>
>> ANC wrote:
>> --- paste ---
>> Disk /dev/sda: 80.0 GB, 80026361856 bytes
>> 255 heads, 63 sectors/track, 9729 cylinders
>> Units = cylinders of 16065 * 512 = 8225280 bytes
>>
>> Device Boot Start End Blocks Id System
>> /dev/sda1 * 1 5264 42282268 7 HPFS/NTFS
>> Partition 1 does not end on cylinder boundary.
>> /dev/sda2 5265 6830 12578895 83 Linux
>> --- end paste ---
>>>
>>> Above are fdisk stats.
>>>
>>> Can anyone tell me how to fix sda1 so it ends on a cyl boundry? I know I
>>> need to resize it (yes I know risks) but I don't know what to resize it
>>> TO!
>>
>> Even Windows ends partitions on cylinder boundaries, so the problem is
>> really that Windows and Linux appear to be translating the disk
>> differently. If you value each OS on the same disk, you need to get
>> them to see the same geometry before you do anything else.
>
> Ok, how do I do that?
>

> Right now Linux works great... boots fine. But the Windows partition won't
> even mount, much less boot with grub. I'm looking for an easy way to fix
> this. I thought that maybe with gparted I could downsize the Windows
> partition a bit so it could be mounted and all would be well.
>
> This all happened when I used QTparted to shrink Windows so I could install
> Linux. Worked fine on wife's laptop... her Windows will boot when she wants
> to (she runs Debian as I do) but it looks like QT hosed my WinXP partition
> for some reason
>
> Thanks,
>
> Al
>
I still think this is the right answer:
http://groups.google.com/group/comp.os.linux.misc/msg/4228abb47d4ab81d

One way to fix the problem is to backup, reformat with a proper geometry,
then restore. I have written about backup/restore techniques for both
GNU/Linux and Windows here and on other newsgroups. I use tar and
ntfsclone. Those are tools which have a real payoff once you learn to use
them. You can try to learn them, or you can keep posting the same question
at some recurring time interval. Your choice.


ANC

unread,
Aug 21, 2006, 1:47:56 AM8/21/06
to
Allen Kistler wrote:

Well, I was hoping there was some 'easy' way to undo the damage of Qtparted
but from what I can find it will just as easy to delete the partition,
re-create and re-install XP and grub. I assume I just create it from cyl 1
and it will know to reserve room for the boot sector? I've never done this
before on sda1... only on sdb where I have 3 other Linux distros. (I run
Kanotix on sda2 as my 'real' distro... and I hope that screwing with sda1
won't bork it... but if so, not big deal. I know the value of backups!

This time I'll use cfdisk. There is nothing on the XP partition I want/need
but I like having XP on sda as every so often there is some proprietary
program I need to run such as Photoshop or Quickbooks and neither run 100%
in Crossover/wine.

Thanks,

Al

ANC

unread,
Aug 21, 2006, 2:17:40 AM8/21/06
to
Douglas Mayne wrote:

I don't see it there. I read it the first time and while it's an interesting
piece, I don't see the applicability. That does not mean it's not there...
I just don't see it. Explain if you care to. I'm open to new ideas.


> One way to fix the problem is to backup, reformat with a proper geometry,
> then restore. I have written about backup/restore techniques for both
> GNU/Linux and Windows here and on other newsgroups.

I see that you have.

http://www.gatago.com/authors_pgs/24833.html

I do a bit of writing (mostly fluff) on Linux and FOSS as well:

http://www.inc.com/articles/2005/01/opensource.html
http://www.inc.com/articles/2005/02/opensource.html
http://www.inc.com/articles/2005/02/adware.html
http://www.inc.com/articles/2005/05/webservices.html
http://www.inc.com/articles/2005/05/usenet.html
http://www.inc.com/articles/2005/09/webdesigner.html
http://software.newsforge.com/software/05/05/17/2114251.shtml?tid=132
http://www.linux.com/article.pl?sid=05/08/31/1533252
http://www.desktoplinux.com/articles/AT3405272862.html
http://www.linux-watch.com/news/NS5206957474.html
http://www.linux-watch.com/news/NS5556692387.html


> I use tar and
> ntfsclone. Those are tools which have a real payoff once you learn to use
> them. You can try to learn them, or you can keep posting the same question
> at some recurring time interval. Your choice.

Well, yes, it IS my choice.

I know you from the Slackware NG. You are here... as you are there. However
I think your truculence plays a bit better in that venue... with the wild
pack of dogs that seek to run that NG.... than I think it plays here in
this one. Indeed, the alt Slack group is the Deadwood and Dodge City of
Linux... go there at your own risk! :-)


Al

Douglas Mayne

unread,
Aug 22, 2006, 11:07:40 AM8/22/06
to
On Mon, 21 Aug 2006 06:17:40 +0000, ANC wrote:

> Douglas Mayne wrote:
>
>
>> I still think this is the right answer:
>> http://groups.google.com/group/comp.os.linux.misc/msg/4228abb47d4ab81d
>>
>
> I don't see it there. I read it the first time and while it's an interesting
> piece, I don't see the applicability. That does not mean it's not there...
> I just don't see it. Explain if you care to. I'm open to new ideas.

It isn't about /* new */ ideas, as much as about the historical reasons
for why things are the way they are with PC architecture, and how we got
here. For one thing, disk capacity has been growing faster than Moore's
Law. We like extra disk capacity, so we'll find a way to use it- whatever
it takes. I'll explain different methods for disk addressing below.

This is the problem as I understand it with this bug. In simplest terms,
your OS needs to know where it is located on your disk. It reads the
partition table to find the partition where the loader and the rest of the
OS is located. When multiple OSs are used, they can be using different
assumptions about the disk geometry and different methods of addressing.
The start of a partition can be in different places, depending on what
assumptions are used. That is a big problem, especially if an OS is using
a "mixed mode" (#3, below.)

Disk addressing method 1: Historical (C,H,S)
Problem: Find a given sector on a hard disk.
Solution 1: Use BIOS Int 13h to retrieve sector. This was the method used
by MS-DOS. In this system, disk geometry (and offsets to sectors) can be
expressed using an ordered triple of three integers:

(Cylinder,Head,Sector).

The original IBM BIOS imposed limits for each value. This imposed an
overall limit for the capacity of hard disks. When each value is at its
maximum, there is a disk limit of 8G (+/-)

Cylinder: (10 bits) (0-1023)
Head: (8 bits) (0-255)
Sector: (6 bits) (1-63)

Disk capacity limit: 1024*256*63*512= 8455716864 bytes

Actual disk capacity exceeded this limit in the 1990s. As the disk
capacity starting approaching the limit, fictional disc geometry was
introduced just to maximize each value in the ordered triple. For example,
the drive would report that it has 256 heads, even though that it had
nowhere close to that many heads. In this era, hard disks had a physical
geometry and a "logical" geometry. The fictional geometry was
called the logical geometry.

Disk capacity is now much greater than 8G. Physical disk geometry can
still be expressed using (C,H,S) with no numerical limits on the values.
Typically, the last cylinder is now much larger than 1023.

The difference/conflict arises when different OS use different fictional
drive geometry. Typically, one OS will be using 16 heads and the other
will be using 256 heads. The location of a "cylinder boundary" will not be
consistent in that case. _The error message you are getting is symptomatic
of this problem_.

Addressing Method 2: LBA
LBA is a system where disk sectors can be retrieved from the beginning of
the disk using a simple value for the offset sector. The size of the disk
is limited by the maximum offset. IIRC, LBA can use 48-bit addresses now.
http://www.48bitlba.com/

That gives a maximum disk limit of 2^57 bytes.

Because LBA does not require (or use) the (C,H,S) ordered triple, and
does not use the cylinder to compute the address, a "cylinder boundary" is
an artifact and does not appear to be relevent. However, the _loaders_ for
OSs would like to see that the partition table matches the assumed drive
geometry in use. So, by convention, disk partitions must still start on a
cylinder boundary. Even though partitions could be described as an
range of sectors beginning at an arbitrary sector offset, they are
constrained (by convention) to starting on a cylinder boundary.

Addressing Method 3: Mixed mode.

Some loaders (in the past) have used (C,H,S) addressing, while the OS used
LBA. lilo used to have a limit like that, but the Linux kernel would
be using LBA to address the disc. In any case, this mixed mode increases
the chance for a conflict somewhere. The NT/2k/XP loaders may use mixed
mode, I don't know for sure.

>
>
>> One way to fix the problem is to backup, reformat with a proper
>> geometry, then restore. I have written about backup/restore techniques
>> for both GNU/Linux and Windows here and on other newsgroups.
>

<snip>
>
Note: comments inline.

The wikipedia has some good basic explanations about disks, too.

--
Douglas Mayne

0 new messages