2001-11-13 14:45:56

by Robert A H Holmberg

[permalink] [raw]
Subject: Odd partition overlapping problem

Hi,
I have a dual-boot setup with win98 and linux. I primarily use linux, but
I want to keep windows around for some inportant productivity
applications, mostly games. My partition table is as follows:

<snip>
[root@localhost documents]# fdisk /dev/hda

The number of cylinders for this disk is set to 3736.
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)

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 3736 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 523 4200966 c Win95 FAT32 (LBA)
/dev/hda2 524 525 16065 83 Linux
/dev/hda3 526 2647 17044965 83 Linux
/dev/hda4 2648 3736 8747392+ 5 Extended
/dev/hda5 2648 2713 530113+ 82 Linux swap
/dev/hda6 2714 3736 8217216 c Win95 FAT32 (LBA)

Command (m for help):
</snip>

/dev/hda3 is my linux root partition (hda2 is /boot) and hda6 is D: in
windows. Somehow, that I can't figure out hda3 overlaps hda6. I see this
by writing some data to hda3, booting to windows and finding out that my
D: is no longer considered "formatted". If I format D: and boot back to
linux, some of my files that I just wrote are corrupted. Since fdisk shows
no overlap and there is tha swap partition between these two partitions, I
can't figure out how this happens (other than, that somewhere there is a
bug and these two partitions DO overlap) and more importantly, for me, how
to stop this from happening without reinstalling my whole system.

My question is, can anyone here give me any ideas of how to debug this
problem? I use Linux 2.4.14 and reiserfs on hda3. I partitioned the drive
with linux fdisk, since I don't trust dos fdisk. My fdisk version is
2.10s .

Please cc to me, I'm not on the list,

Robert Holmberg


2001-11-13 15:09:23

by Richard B. Johnson

[permalink] [raw]
Subject: Re: Odd partition overlapping problem

On Tue, 13 Nov 2001, Robert A H Holmberg wrote:

> Hi,
> I have a dual-boot setup with win98 and linux. I primarily use linux, but
> I want to keep windows around for some inportant productivity
> applications, mostly games. My partition table is as follows:
>
> <snip>
> [root@localhost documents]# fdisk /dev/hda
>
> The number of cylinders for this disk is set to 3736.
> 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)
>
> Command (m for help): p
>
> Disk /dev/hda: 255 heads, 63 sectors, 3736 cylinders
> Units = cylinders of 16065 * 512 bytes
>
> Device Boot Start End Blocks Id System
> /dev/hda1 * 1 523 4200966 c Win95 FAT32 (LBA)
> /dev/hda2 524 525 16065 83 Linux
> /dev/hda3 526 2647 17044965 83 Linux
> /dev/hda4 2648 3736 8747392+ 5 Extended
> /dev/hda5 2648 2713 530113+ 82 Linux swap
> /dev/hda6 2714 3736 8217216 c Win95 FAT32 (LBA)
>
> Command (m for help):
> </snip>
[SNIPPED...]

The extended partition goes from 2648 to 3736. The first part of
this extended partition from 2648 to 2713 is swap. The second part
of 2714 to 3736 is the FAT32 partition. It looks as though M$ tries
to use the swap area, ignoring the 82 code for Linux swap. This
may be why the M$ partition gets trashed. To test this theory,
disable swap on this drive (comment it out in /etc/fstab). Re-do
the M$ partition and see if it remains clean. If it remains
clean, then do a `mkswap` from Linux. Reboot to M$ and verify that
the last partition is now corrupt. This will show that M$ is
trying to use the swap area. If it is, re-fdisk the extended
partition to put Linux swap at the end instead of the beginning.

This should work around the M$ bug.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.


2001-11-13 15:45:34

by Robert Holmberg

[permalink] [raw]
Subject: [Probably OT] Re: Odd partition overlapping problem

On Tue, 2001-11-13 at 10:08, Richard B. Johnson wrote:
> > Device Boot Start End Blocks Id System
> > /dev/hda1 * 1 523 4200966 c Win95 FAT32 (LBA)
> > /dev/hda2 524 525 16065 83 Linux
> > /dev/hda3 526 2647 17044965 83 Linux
> > /dev/hda4 2648 3736 8747392+ 5 Extended
> > /dev/hda5 2648 2713 530113+ 82 Linux swap
> > /dev/hda6 2714 3736 8217216 c Win95 FAT32 (LBA)
> The extended partition goes from 2648 to 3736. The first part of
> this extended partition from 2648 to 2713 is swap. The second part
> of 2714 to 3736 is the FAT32 partition. It looks as though M$ tries
> to use the swap area, ignoring the 82 code for Linux swap. This
> may be why the M$ partition gets trashed. To test this theory,
> disable swap on this drive (comment it out in /etc/fstab). Re-do
> the M$ partition and see if it remains clean. If it remains
> clean, then do a `mkswap` from Linux. Reboot to M$ and verify that
> the last partition is now corrupt. This will show that M$ is
> trying to use the swap area. If it is, re-fdisk the extended
> partition to put Linux swap at the end instead of the beginning.

Yes, well, the problem is more serious than that, since formatting the
windows partition will write unwanted stuff to my main linux partition
as well. This partition is 17GB, but less than 3GB is used. Unless
reiserfs writes stuff all over the place, there shouldn't be data
anywhere near the end of this partition.

Anyway, I don't want to kill off random files on my linux partition if
there is some other way to test this.

BTW, sfdisk -l -x /dev/hda says:

Disk /dev/hda: 3736 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from
0

Device Boot Start End #cyls #blocks Id System
/dev/hda1 * 0+ 522 523- 4200966 c Win95 FAT32 (LBA)
/dev/hda2 523 524 2 16065 83 Linux
/dev/hda3 525 2646 2122 17044965 83 Linux
/dev/hda4 2647 3735 1089 8747392+ 5 Extended

/dev/hda5 2647+ 2712 66- 530113+ 82 Linux swap
- 2713 3735 1023 8217247+ 5 Extended
- 2647 2646 0 0 0 Empty
- 2647 2646 0 0 0 Empty

/dev/hda6 2713+ 3735 1023- 8217216 c Win95 FAT32 (LBA)
- 2713 2712 0 0 0 Empty
- 2713 2712 0 0 0 Empty
- 2713 2712 0 0 0 Empty

cc to me, I'm not on the list.

Robert

2001-11-14 11:02:08

by Guest section DW

[permalink] [raw]
Subject: Re: [OT] Odd partition overlapping problem

On Wed, Nov 14, 2001 at 10:02:59AM -0500, Robert Holmberg wrote:

> It seems my hda 6 is overlapping my hda4.
>
> Partition table:
> Device Boot Start End Blocks Id System
> /dev/hda1 * 1 523 4200966 c Win95 FAT32 (LBA)
> /dev/hda2 524 525 16065 83 Linux
> /dev/hda3 526 2647 17044965 83 Linux
> /dev/hda4 2648 3736 8747392+ 5 Extended
> /dev/hda5 2648 2713 530113+ 82 Linux swap
> /dev/hda6 2714 3736 8217216 c Win95 FAT32 (LBA)

There is nothing wrong with this partition table,
from a Linux point of view.

But lots of things may be wrong in the Windows - Linux cooperation.

Windows has its own data independent of the partition table.
So, if you change the partition table Windows may still use
the original partitioning.

Something else that may be bad: type 5 becomes type f when LBA
should be used. Since you are past cylinder 1024 you do not
want the CHS data to be used.

Something else that may be bad: DOS/Windows expects that type 5/f is
their own. At least the first partition in an extended should
be a DOS/Windows one, otherwise some programs will be unhappy.

Etc.

Try first f instead of 5, that is the easiest change.

2001-11-14 11:08:48

by Guest section DW

[permalink] [raw]
Subject: Re: Odd partition overlapping problem

On Tue, Nov 13, 2001 at 04:45:35PM +0200, Robert A H Holmberg wrote:

> I partitioned the drive with linux fdisk, since I don't trust dos fdisk.

But Linux fdisk and DOS FDISK do not have precisely the same function.
Linux fdisk only writes the partition table. DOS FDISK also writes
boot sector information. Generally, you should use the fdisk type
program belonging to OS X before installing OS X.