-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssdfmt
72 lines (57 loc) · 3.13 KB
/
ssdfmt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
SSD as Superfloppy Tools
Tools for preparing an SSD with a superfloppy format for use with DOS
operating systems.
These tools can be used with SD cards as well as SSDs provided you
know the erase size, which is larger than the physical sector size.
Requrements:
* 8086 PC with 192kb RAM (128kb free)
* MS-DOS 2.01 or newer
* BIOS service int 13h ah=08h that works (no EZDrive)
* Second generation SSD with automatic wear levelling
* You must know the physical sector size
* Don't use SSDs advertised as optimized for Windows XP
The technology used in SSDFMT is newer than the technology in FORMATHD,
and as a consequence, patching DOS is no longer required. SSDFMT contains an
internal quickformat routine that writes the FAT filessytem aligned to the
physical sectors, while still presenting to DOS the 512 byte logical sectors
that DOS expects. The boot sequence knows it's running on an SSD and not a
rotating head disk, and performs a boot time check for torn writes to the
FAT resulting in erased sectors rather than the read errors that DOS expects
and fixes these automatically.
This project sets up the filesystem from inside operating system rather
than from any host operating system (and thus should work on bare hardware).
Installation instructions for a VM guest:
ALL DATA ON THE TARGET DISK WILL BE ERASED.
1: Prepare a MS-DOS boot floppy for the version of DOS you want to install.
You will need SYS.COM and whatever to access install media.
2: Copy SSDFMT.COM and SSDFIXBT.COM to it
3: Run SSDFMT.COM
4: Select SSD, sector size, and minimum MS-DOS version.
5: Reboot
6: Run SYS C:
7: If you have Windows 95 OSR2, run SSDFIXBT /U /I immediately after SYS C:
to repair damage caused by SYS.COM not following the FAT32 specification.
8: Install DOS
9: Run SSDFIXBT to fix damage to the MBR caused by step 8.
I have verified these instructions on MS-DOS 6.20 and Windows 95 under
DOSBox-X, and on MS-DOS 5.0 on QEMU.
Some SSDs with 4096 byte sectors were sold as optimized for Windows XP. This
was done by leaving a gap between the 63rd and the 64th logical sector so
that future writes to the NTFS datastructures were aligned with the 4096
byte physical sector size. Such SSDs should not be used with SSDFMT as this
completely defeats the alignment logic and risks arbitrary data corruption
due to impossible (and therefore unhandled) torn writes.
If you use this tool to write an aligned FAT16 filesystem and install
Windows NT on it, or a FAT32 filesystem and install Windows XP on it, and
later run CONVERT.EXE to convert the filesystem to NTFS, run the included
POSTNTFS.EXE to get rid of the shadow bootsector to avoid data loss.
The hard disk geometry plays havok with QEMU's auto-detect disk geometry. If
you use this with QEMU, you must specify the geometry manually, which makes
for a very long command line. Example:
qemu-system-i386 -cpu pentium \
-drive if=none,id=mydisk,format=raw,file=hd.img \
-device ide-hd,drive=mydisk,cyls=1024,heads=16,sects=63 \
-fda freedos-ssd.img \
-boot a
This is a good candidate to write down once and put in a startup script.
Copyright (C) Joshua Hudson 2022, 2023 Licensed under CC-BY-SA 4.0