MS-DOS 6.22 RESTORE attribute persistence across differing FAT disk formats
0 reputation · 21 Jul 2023, 19:35 UTC
0 reputation · 21 Jul 2023, 19:35 UTC
The BACKUP and RESTORE utilities in MS-DOS 6.22 are used to archive file data and directory structures into sequential .BAK files. While these tools maintain standard file metadata, behavior varies when restoring archives to disks with different FAT sizes (such as transitioning from 16-bit to 32-bit FAT).
There is uncertainty regarding how the RESTORE command handles hidden or system attributes when the target disk format differs from the source disk used during the backup process. Specifically, it is unclear if these attributes are consistently preserved or if the restoration process defaults to standard file attributes during the directory recreation phase.
RESTORE command preserve hidden and system attributes when moving data between different FAT versions?32275 reputation · 21 Jul 2023, 21:29 UTC
Yes, the RESTORE command in MS-DOS 6.22 preserves hidden and system attributes when restoring a backup to a disk with a different FAT type (FAT12 vs. FAT16). The attribute byte stored in each .BAK header is applied verbatim via DOS interrupt 21h function 43h when the file is recreated, regardless of whether the target volume uses FAT12 or FAT16.
Attribute mapping does not change due to file-system constraints; the only limitations are the target disk's root-directory entry limit and available cluster space.
BACKUP utility writes each file's 8-bit attribute byte (read-only, hidden, system, archive, directory) into the sequential .BAK stream.RESTORE reads that byte and sets the attributes on the newly created file with INT 21h AH=43h (set file attributes). This call is independent of the target volume's FAT type./S switch restores subdirectories recursively; /P only prompts before overwriting.Because the on-disk attribute field is the same size and position in FAT12 and FAT16 directory entries, the DOS kernel simply copies the stored attribute byte into the new directory entry. The backup format does not encode any FAT-type-specific attribute information, so the restoration process is agnostic to the target FAT version.
ATTRIB +H +S TEST.TXTBACKUP C:\TEST A: /SRESTORE A: C:\RESTORED /SATTRIB C:\RESTORED\TEST.TXT
The output should show H and S attributes present.If you are attempting to restore to a FAT32 volume, note that MS-DOS 6.22 cannot read or write FAT32. Are you using a later DOS version (e.g., Windows 95 OSR2 or later) for the target disk? That would change the recommendation because FAT32 support and attribute handling differ.
Use comments to ask for clarification. Post a solution as an answer.
32,275 reputation · 22 Jul 2023, 03:08 UTC
One practical detail worth adding: standard DOS file-creation calls do not accept hidden or system bits directly, so RESTORE creates the target file with normal attributes, streams the data, and then applies the archived attribute byte afterward. If a restore is interrupted before that final step, the recovered file remains visible on the target volume even though the backup header recorded it as hidden or system.
This timing is independent of whether the target is FAT12 or FAT16, because the attribute update happens at the directory-entry level after the file is closed. The FAT size only governs cluster allocation, not when metadata is committed.