VOGONS

Common searches


First post, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie

I noticed a very odd partitioning problem that manifests with MS-DOS and maybe a few others.

It feels like some kind of inconsistency with the partition table that's causing a second primary partition on one of the disks not correctly recognized while in MS-DOS. However, the partition in question is recognized correctly in FreeDOS, PC-DOS 7.1 and even NT 3.51 (with UniATA). More modern systems like Windows XP/7 and Linux do not have any issue with it, either.

The partition in question was originally a logical one, but later on I decided to convert it to primary using DiskGenius (which could do it) from a WinPE environment, as it turned out NT 3.51 doesn't understand LBA extended partitions, even with the UniATA driver.

After conversion, everything looked good until I go back to MS-DOS 7.1 only to find out it could not read the partition anymore. Interestingly, I could somehow format it using FreeDOS' FORMAT from MS-DOS, though at first the partition would not be given a label even though I specified one (I could, however, put up its label via LABEL command). This is where the inconsistency begins. After formatting the disk from MS-DOS (given a different serial number), my other OSes still see the original filesystem of that partition along with the original serial number... and even fsck is not reporting any error when I checked the partition in question.

On the other hand, while FreeDOS' FDISK saw everything correctly, MS-DOS' FDISK showed garbled data when displaying disk information, especially when it comes to the disk on which the partition problem manifests. Perhaps it's also due to the FDISK being too dated and not able to handle too large disks, as it was reporting a wrong and apparently too small total size for the disk in question.

Feeling confused, I tried clearing the partition table several times and recreated the partitions many times over but the condition persists, even though I did every step as expected. Later on I altered the size of the two partitions on that disk, making the first one smaller and the second one larger, and I found out, to my horrors, that FreeDOS' FORMAT, when run from MS-DOS, actually formatted the first partition using the original size (before I resized). This means to MS-DOS the disk layout has always been the very initial state, before I converted the second partition from logical to primary, as well as my subsequent resizing of the two partitions.

(NOTE: If I format the partition from DOS first, the partitions would still appear unformatted to other OSes until I format it there also, and formatting the partition there would not break the state that MS-DOS could already see. Files copied to the disk on one of the states would not be visible to the other. I haven't tested copying different files to both states as there's a great chance this would lead to corruptions.)

The first partition can always be correctly accessed from any OS including MS-DOS, even after being formatted with the wrong size (GParted would give out an exclamation mark in this case). It's the second partition that couldn't be correctly accessed in MS-DOS and is having the discrepancies between MS-DOS and other OSes.

I did some further tests with other DOS variants than FreeDOS and PC-DOS 7.1 using boot disks, and looks like this issue also manifests in those, albeit the behavior varies.
EDR-DOS: Divide Error when accessing the partition in question.
ROM-DOS 7.1: Boot fails halfway with a "Divide by zero" error possibly related to the partition in question considering the similar error message from EDR-DOS when accessing it.
PTS-DOS 32: Error when accessing the partition in question. Additionally, drive letter assignment order is different here.

I'm not sure about the cause of the issue, but on this particular system, it appears there are some issues with the location offsets when creating partitions with legacy utilities, or with modern utilities (and MiB alignment).
- When creating partitions using GParted with MiB alignment, it leaves about ~1MB free space on the very beginning of the disk (that can somehow be seen by WinXP), and this empty space would somehow prevent most of the boot sectors (especially NTLDR) from working correctly. For DOS, usually doing another SYS would temporarily fix it, but not that easy for others. Not sure if this is an issue with my board's BIOS, or is an intended behavior...
- Legacy utilities like Norton PartitionMagic could correctly create the partitions without the aforementioned free space. However, it apparently lacked the ability to format very large FAT32 partitions so I have to do it elsewhere. Also, it only appears to work when the disk's partition table is empty. After I created the partitions (not formatting them here), if I boot to PartitionMagic again right after reboot (without doing anything else), I would get a partition table error #110 on the disk in question (I'm not very versed with that program's error codes, however).

In the end I gave up using MS-DOS 7.1 since it's too dangerous to use with the system in this state. I decided to use PC-DOS 7.1 as that one correctly sees my partitions, while also boot to FreeDOS kernels via GRUB4DOS.

Reply 1 of 12, by myne

User metadata
Rank Member
Rank
Member

That is very strange.

Personally, I'd jam it in a W10/11 box and run diskpart and clean it

diskpart
list disk
select disk 9876543
clean

9876543 = the drive number from the result of list disk

Then see if it's still recognised as having anything by any of the OS'

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)

Reply 3 of 12, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
kixs wrote on 2024-02-15, 09:41:

What is the size of HDD?

The disk in question is very large (2TB), and is used for data, not booting. That's the practical maximum I could use on those relatively old systems...

A long time ago I tried 3TB disks with XP using 2003's disk.sys which supported GPT, and the disk ended up badly corrupted. It was mostly my own fault for not heeding the warning given by Hard Disk Sentinel (regarding the BIOS reporting the disk as being only ~970GB).

I wonder how large disks could MS-DOS 7.1/8.0 handle. I know Windows 9x had a 137GB barrier by default, but not sure if that was also applicable to MS-DOS (that would be really bad). However, this doesn't answer why MS-DOS is seeing and even formatting partitions using old size even after I changed the layout in the partition table...

So far it looks like PC-DOS 7.1 and FreeDOS are handling such large disks fine, while others exhibit their own behaviors for this problem...

myne wrote on 2024-02-15, 09:25:
That is very strange. […]
Show full quote

That is very strange.

Personally, I'd jam it in a W10/11 box and run diskpart and clean it

diskpart
list disk
select disk 9876543
clean

9876543 = the drive number from the result of list disk

Then see if it's still recognised as having anything by any of the OS'

It's only some DOS variants having issues. In other places, everything is fine.

Though I do wonder why Linux partitioning tools would leave too much space at the beginning of the disk when creating them with MiB alignment... maybe driver related? It's not a common occurrence as in other systems of mine partitions can be created just fine (using MBR) even with MiB alignment.

Reply 4 of 12, by weedeewee

User metadata
Rank l33t
Rank
l33t

WRT your question about MiB alignment, FYI https://en.wikipedia.org/wiki/Partition_alignment

The 1MiB alignment is one of those SSD alignment thingies.

Right to repair is fundamental. You own it, you're allowed to fix it.
How To Ask Questions The Smart Way
Do not ask Why !
https://www.vogonswiki.com/index.php/Serial_port

Reply 5 of 12, by myne

User metadata
Rank Member
Rank
Member
LSS10999 wrote on 2024-02-15, 10:02:

I wonder how large disks could MS-DOS 7.1/8.0 handle. I know Windows 9x had a 137GB barrier by default, but not sure if that was also applicable to MS-DOS (that would be really bad).

Uh... 100% same limitation

Things I built:
Mechwarrior 2 installer for Windows 10/11 Re: A comprehensive guide to install and play MechWarrior 2 on new versions on Windows.
Dos+Windows 3.11 auto-install iso template (for vmware)

Reply 6 of 12, by Riikcakirds

User metadata
Rank Member
Rank
Member
LSS10999 wrote on 2024-02-15, 10:02:

The disk in question is very large (2TB), and is used for data, not booting. That's the practical maximum I could use on those relatively old systems...

I wonder how large disks could MS-DOS 7.1/8.0 handle. I know Windows 9x had a 137GB barrier by default, but not sure if that was also applicable to MS-DOS (that would be really bad). However, this doesn't answer why MS-DOS is seeing and even formatting partitions using old size even after I changed the layout in the partition table...

So far it looks like PC-DOS 7.1 and FreeDOS are handling such large disks fine, while others exhibit their own behaviors for this problem...

Dos7.1/8 support 2TB single partition Fat32 drive (and Win98se/Winme but you need to used patched ESDI_506.PDR file - made by LLXX from forum MSFN)

I use a 2TB FAT32 SSD in Dos7.1, single partition. Dos7.1 will work 100% safely as long as motherboard bios (or PCI IDE controller with bios ext) supports 48-bit LBA.

The only steps I use, I always partition the disk using diskpart, single active primary partition or whatever you want. Make sure partition type for each partition is correct after/ Check with a program like bootice etc i.e '0c' for LBA Fat32, not '06'. Don't use fdisk in Dos to create partitions.
To format I connect drive to computer running Dos7.1 and use oformat.com (an updated and enhanced version of the last WinMe Dos 8 Format) it supports 2TB drives, has a quick format option and the option to align clusters to 4K ( /A:8 switch). You can get oformat from deploy.cab in XPSP3 or Win2k3 deploy.cab -it is dated 2006.

Reply 9 of 12, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
megatron-uk wrote on 2024-02-18, 20:13:

What's the actual use case for a 2tb drive/volume/partition for Dos/Win95|98|ME?

The system runs a wide variety of systems for all kinds of purposes. I'm not using the whole 2TB for DOS.

Riikcakirds wrote on 2024-02-18, 17:04:
Dos7.1/8 support 2TB single partition Fat32 drive (and Win98se/Winme but you need to used patched ESDI_506.PDR file - made by […]
Show full quote

Dos7.1/8 support 2TB single partition Fat32 drive (and Win98se/Winme but you need to used patched ESDI_506.PDR file - made by LLXX from forum MSFN)

I use a 2TB FAT32 SSD in Dos7.1, single partition. Dos7.1 will work 100% safely as long as motherboard bios (or PCI IDE controller with bios ext) supports 48-bit LBA.

The only steps I use, I always partition the disk using diskpart, single active primary partition or whatever you want. Make sure partition type for each partition is correct after/ Check with a program like bootice etc i.e '0c' for LBA Fat32, not '06'. Don't use fdisk in Dos to create partitions.
To format I connect drive to computer running Dos7.1 and use oformat.com (an updated and enhanced version of the last WinMe Dos 8 Format) it supports 2TB drives, has a quick format option and the option to align clusters to 4K ( /A:8 switch). You can get oformat from deploy.cab in XPSP3 or Win2k3 deploy.cab -it is dated 2006.

If DOS 7.1/8's disk capabilities is all up to the BIOS then it should be fine.

I wonder if there's any bootable tool that could accurately inspect raw disk sectors, as I do worry that MS-DOS might be looking at a different location for partition layout compared to other OSes including FreeDOS. Back then I tried dumping disk contents with dd but could not find anything out of ordinary. I suspect there are some issues with the disk controller drivers used by Linux, as on this system, partitions created by GParted appear a bit too off the mark that WinXP could see a visible ~1MB at the beginning of the disk, and this prevented some boot sectors expecting things at the very beginning of the disk (including NTLDR) from working. On relatively modern systems GParted could create partitions more accurately without breaking boot sectors.

I'm not experienced with diskpart. I do most of the partitioning with GParted as it's very easy to work with. The only caveat is that I need to manually mark FAT32 and Extended partitions as "lba" as GParted won't do this automatically.

But in the end... it's still safer to just use a single FAT32 primary partition for DOS per disk as this would save the hassle with some problematic OS kernels not handling partition tables properly, especially with multiple visible primary partitions on a single disk.

Reply 10 of 12, by megatron-uk

User metadata
Rank Oldbie
Rank
Oldbie

Okay, so Dos doesn't need the full disk... Have you looked at grub4dos? I haven't used grub in many, many years, but my understanding is that it can chainload Dos (and other operating systems) from within an existing partition or image file.

Gparted does try to do things like round up sizes to various alignments to optimise transfers, sector alignments etc c, but I am fairly sure you can set it to operate in raw mode so that it slices up the disk exactly at the sectors you specify. Putting the first partition at +1024kb is fairly common with it.

My collection database and technical wiki:
https://www.target-earth.net

Reply 11 of 12, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
megatron-uk wrote on 2024-02-19, 08:33:

Okay, so Dos doesn't need the full disk... Have you looked at grub4dos? I haven't used grub in many, many years, but my understanding is that it can chainload Dos (and other operating systems) from within an existing partition or image file.

... I'm already using it. It saved a lot of hassle I'm having with multibooting different OSes.

megatron-uk wrote on 2024-02-19, 08:33:

Gparted does try to do things like round up sizes to various alignments to optimise transfers, sector alignments etc c, but I am fairly sure you can set it to operate in raw mode so that it slices up the disk exactly at the sectors you specify. Putting the first partition at +1024kb is fairly common with it.

I know GParted can create partitions at cylinder boundaries, just I don't use it often.

Right now the partition alignment issue is not important compared to the issue where MS-DOS is starting to see a different partition layout than expected...

Reply 12 of 12, by Riikcakirds

User metadata
Rank Member
Rank
Member
megatron-uk wrote on 2024-02-18, 20:13:

What's the actual use case for a 2tb drive/volume/partition for Dos/Win95|98|ME?

First of all I had a few 2TB SSD drives left over from work, that's the main reason I tried this. Also to test if the maximum limit of MBR which is 2TB works reliably with no data loss in DOS/Win9x.

The use case was having 1 bootable drive to keep all my Dos and Win9x games/utils on. No messing about with lots of smaller drives. As soon as you start archiving CD images of games to play so you don't need the physical CD the space goes in no time.
Now I can boot to Dos7.1/Win9x on one drive with everything I need on it. This works on my 1994 486 DX2 socket 3 (with TX2 S150 pci controller) right up to Core 2 duo systems and later, it's much more convenient and easy to backup.

Of course drives bigger than the 2TB MBR limit will become a big problem in the future when they stop making new cheap mainstream SSD drives below this capacity.
I remember buying 32 GB SSDs when they were first out and now it's virtually impossible to buy new SSDs smaller than 120GB.