VOGONS


Reply 20 of 29, by Falcosoft

User metadata
Rank l33t
Rank
l33t
stanwebber wrote on 2025-07-13, 13:06:
i read this whole thread & i'm still confused. did the OP ever get a cf card aligned to 2048 sectors to boot in his 386 machine? […]
Show full quote

i read this whole thread & i'm still confused. did the OP ever get a cf card aligned to 2048 sectors to boot in his 386 machine?

i'm running into this same issue right now with an early p54c pentium bios. is the limitation bios or dos related?

this CAN work with dos 7.1 & fat32 on an award kt133a bios. i partition either a sata ssd or cf card with gparted aligned to 2048 sectors and the os just boots. the only problem i ran into was dos not recognizing a logical drive in an extended partition unless it was cylinder aligned with dos tools.

now i have a fat16 1gb cf card that will not boot in my p54c pentium machine unless i partition it with dos fdisk. when previously partitioned with gparted aligned to 2048 sectors, dos had no problems recognizing the drive from a boot floppy--just no boot.

what is the magic for alignment? if rmprepusb is the answer, what is it doing differently that gparted isn't?

The moral of this whole thread is that there is no point to partition align FAT/FAT32 volumes to 2048 sectors. This approach works in case of NTFS since the metada is part of the file system but it does not work in case of FAT/FAT32 since the metadata/header is before the file system so proper alignment works differently
(from here: Re: MS-DOS with aligned partitions on CF card, is it possible?)

Website, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper
x86 microarchitecture benchmark (MandelX)

Reply 21 of 29, by stanwebber

User metadata
Rank Member
Rank
Member
Falcosoft wrote on 2025-07-13, 13:24:

The moral of this whole thread is that there is no point to partition align FAT/FAT32 volumes to 2048 sectors. This approach works in case of NTFS since the metada is part of the file system but it does not work in case of FAT/FAT32 since the metadata/header is before the file system so proper alignment works differently
(from here: Re: MS-DOS with aligned partitions on CF card, is it possible?)

truth be told, i'm not sure i understand why it's important for ANY flash media to be sector aligned. this whole alignment business started with mechanical hdds switching to physical 4k sectors and using a translation layer to present 512b sectors to the system bios. does all flash media do the same thing?

Reply 22 of 29, by GigAHerZ

User metadata
Rank Oldbie
Rank
Oldbie
stanwebber wrote on 2025-07-13, 13:06:

i read this whole thread & i'm still confused. did the OP ever get a cf card aligned to 2048 sectors to boot in his 386 machine?

Some time later i eventually found YSDDT. As far as i can confirm, it does what needs to be done - it realigns the FAT16 partition and DOS is able to boot from it after the alignment.
You need to use quite a lot of flags on the program to run it. Have a second screen with manual ready. With flash memory, do not forget 'fatusedonly' along with other flags!
Also, you sometimes need to override some parts of partition info using 'fatnew*' or 'fatuse*' flags.

It seems to be working, but i don't have long-term extensive experience with it, yet.

"640K ought to be enough for anybody." - And i intend to get every last bit out of it even after loading every damn driver!
A little about software engineering: https://byteaether.github.io/

Reply 23 of 29, by doshea

User metadata
Rank Oldbie
Rank
Oldbie
stanwebber wrote on 2025-07-13, 13:52:

truth be told, i'm not sure i understand why it's important for ANY flash media to be sector aligned. this whole alignment business started with mechanical hdds switching to physical 4k sectors and using a translation layer to present 512b sectors to the system bios. does all flash media do the same thing?

I never really thought about it before, but from https://en.wikipedia.org/wiki/Flash_memory:

One limitation of flash memory is that it can be erased only a block at a time.

I think block sizes are generally much bigger than 512 bytes, so I think writes can be expensive if they require an erase first. I imagine that would get even worse if your write isn't aligned, e.g. writing one FAT cluster requires you to read half the cluster from one block, half from another, erase both blocks, then rewrite them both.

Maybe this is why I find compact flash as a hard drive replacement doesn't perform as great as I'd expect? 😁

Reply 24 of 29, by Falcosoft

User metadata
Rank l33t
Rank
l33t
stanwebber wrote on 2025-07-13, 13:06:

...
what is the magic for alignment? if rmprepusb is the answer, what is it doing differently that gparted isn't?

I missed this part of your question.
The answer is that contrary to GParted RMPrepUSB besides partition alignment also makes sure that FAT/FAT32 data clusters start at aligned sectors/LBA addresses. GParted does not do this automatically.
And as @doshea pointed out above this can be also relevant in case of flash drives not just advanced format HDDs.

Website, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper
x86 microarchitecture benchmark (MandelX)

Reply 25 of 29, by stanwebber

User metadata
Rank Member
Rank
Member

my bios was so finicky nothing i did could consistently get it to boot except the following:

- create new msdos partition table with gparted
- wipe reserved sectors with disk genius
- create hibernation partition with phdisk (likely optional)
- create fat16/32 partition with microsoft fdisk
- format with microsoft using /s flag (sys would proobably work as well)

i landed on this process after over a couple dozen other trial & error attempts. with this process i installed/reinstalled win95rtm, nt4 sp6, win2k & win98fe on 4 separate 1gb cf cards without a single hickup. ysddt looks like it can accomplish the same thing and more, but i don't know if i have the patience to look into it at this point.

needless to say nothing is aligned. i'm not so concerned about performance as the top mode of the ide controller is pio 4, but flash longevity is still of concern. the cf cards are labelled as industrial, but oddly they still have the removable flag set. not a concern for any of the operating systems i'm working with, but i thought all industrial cards were fixed hdd.

Reply 26 of 29, by Tecchie

User metadata
Rank Newbie
Rank
Newbie

Guys, simply use Partition Magic 8.04, and set the drive up fresh with it

Reply 27 of 29, by Falcosoft

User metadata
Rank l33t
Rank
l33t
Tecchie wrote on Yesterday, 02:28:

Guys, simply use Partition Magic 8.04, and set the drive up fresh with it

Have you even read this thread?
Partition Magic 8.04 does nothing regarding FAT/FAT32 data cluster alignment...

Contrary to NTFS in case of FAT/FAT32 partition alignment is not enough to get optimal speed.
In case of NTFS metadata is part of the file system (MFT) but in case of FAT/FAT32 the metadata is before the file system and the size of metadata is not fixed but depends on the partition and cluster size.
In order to get optimal speed you need to get First FAT table, Second FAT table, Root Directory and most importantly the First file data (cluster 0) to begin at aligned LBA addresses.

Website, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper
x86 microarchitecture benchmark (MandelX)

Reply 28 of 29, by Riikcakirds

User metadata
Rank Member
Rank
Member

I have used OFORMAT.COM in the past (Inside Windows 2003 SP2 Deployment Tools (deploy.cab) and XPSP3). It is an updated DOS8/ME format for OEMS dated 2006.
One of the new switches is the /A switch. It says "The new /A command causes OFORMAT to align FAT data clusters. Specifically, the /A:8 option can be used to format the volume so that the FAT data clusters are aligned at 4K boundaries"
This could be tested versus rmprepusb and benchmarked with an SD or SSD to see if it is as fast or faster.

It seems MS released these tools for oems to optimally convert from FAT32 to NTFS, but we might be able to use them to align a fat fromat to 4k clusters or greater (32k for large fat32 drives).

I also noticed another dos program in deploy.cab called Cvtarea.exe. Haven't used it yet but it mentions "to create a reserved, contiguous, placeholder file for a less fragmented and more efficient file system before you convert the hard disk to the NTFS file system".
Probably no use to us if you keep the drive as fat32.

https://www.betaarchive.com/wiki/index.php?ti … _Archive/321880

Reply 29 of 29, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie
doshea wrote on 2025-07-19, 07:51:

I think block sizes are generally much bigger than 512 bytes, so I think writes can be expensive if they require an erase first. I imagine that would get even worse if your write isn't aligned, e.g. writing one FAT cluster requires you to read half the cluster from one block, half from another, erase both blocks, then rewrite them both.

Maybe this is why I find compact flash as a hard drive replacement doesn't perform as great as I'd expect? 😁

ATA disks can have an internal write-cache, usually disabled because the OS wants to preserve the guarantee that once the IRQ from the write comes in, that the data is guaranteed written even if the power goes out afterward. You can enable it with e.g. Linux hdparm but I haven't done much testing there, mostly since write-tests would needlessly add wear.

To summarize this thread in general,
The DOS MBR wants partitions to be cylinder-aligned, except that the very first partition can is one track into the disk.
Because of historical CHS/translation accidents, cylinders are on very odd (255*63 sector) boundaries on substantially-sized disks, and the first track is 63 sectors into the disk--odd numbers.
Modern partitioning tools ignore DOS requirements and don't bother with cylinder-aligning partitions. Linux tends to megabyte-align them for example (helping with flash blocks mentioned above).
Modern file systems assume the partition containing them is already aligned, and so keep their data structures aligned too. FAT doesn't care about this, and is perfectly happy to start an important data structure, or the data area, on oddball sectors like 19 or 33 (in case of a floppy I just checked). So even if a FAT partition starts on a megabyte, 64K, or 4K boundary, unaware FAT formatting tools will happily mis-align data structures once again.
That's why aligning a FAT partition requires a tool that is filesystem-aware, to pad these data structures so that the FAT/data area start on a nice even boundary, not just aligning the partition containing it.