This conces FreeDOS specifically.
When formatting a drive FAT16, the label can be specified. That label ends up (in uppercase) at offset 0x7ff8002b of the partition superblock (the partition begins at offset0x 7ff80000). This is the string that FreeDOS’s fdisk prints in the partition overview. Initially, related tools like vol and label show the same string.
Now, after relabeling the file system with label, that string remains unchanged at the initial location. Instead, I end up with the string specified at some offset inside the file table, surrounded by directory entries.
The steps executed on the DOS end are (typed that, no cut’n’paste from the QEMU window):
c:> format d:
… enter label MYLABEL at prompt
c:> vol d:
… displays the label MYLABEL
c:> label d: whocares
c:> vol d:
… displays the new label WHOCARES
But fdisk still reports the earlier label! Now, when inspecting the image with strings(1), I see:
7ff8002b MYLABEL FAT16 1
7ffb8600 WHOCARES
This is the contents of the first block of the partition after a format:
# dd if=/store/dos-data.img count=1 bs=512 skip=4193280 2>/dev/null | xxd -e
00000000: 46903ceb 534f4452 00312e34 00011002 .<.FRDOS4.1.....
00000010: 00020002 00e1f800 0080003f 003ffc00 ........?.....?.
00000020: 000e0700 0e290080 4d386d13 42414c59 ......)..m8MYLAB
00000030: 20204c45 41462020 20363154 c0312020 EL FAT16 1.
00000040: bcd08efa 0efb7c00 5e19eb1f c008acfc .....|.....^....
00000050: 0eb40974 cd0007bb 31f2eb10 cd16cdc0 t..........1....
00000060: fdebf419 54ffe4e8 20736968 6e207369 .......This is n
00000070: 6120746f 6f6f6220 6c626174 69642065 ot a bootable di
00000080: 202e6b73 61656c50 69206573 7265736e sk. Please inser
00000090: 20612074 746f6f62 656c6261 6f6c6620 t a bootable flo
000000a0: 20797070 0d646e61 6572700a 61207373 ppy and..press a
000000b0: 6b20796e 74207965 7274206f 67612079 ny key to try ag
000000c0: 2e6e6961 0a0d2e2e 00000000 00000000 ain.............
… zeros omitted
This is what the region around the new label looks like:
# dd if=/store/dos-data.img count=1 bs=512 skip=$(( 0x7ffb8600 / 512 )) 2>/dev/null | xxd -e
00000000: 434f4857 53455241 28202020 00000000 WHOCARES (....
00000010: 00000000 5df70000 000048d0 00000000 .......].H......
00000020: 69006641 65006c00 0f002e00 00741900 Af.i.l.e......t.
00000030: 00740078 ffff0000 0000ffff ffffffff x.t.............
00000040: 454c4946 20202020 20545854 5e1b0000 FILE TXT ...^
00000050: 000048d0 5e1b0000 000248d0 0000000f .H.....^.H......
00000060: 00000000 00000000 00000000 00000000 ................
… tons of zeros
Where FILE.TXT is a file on that file system containing the string filecontents.
To sum up, I’d like to know:
a) What FreeDOS command (preferably non-interactive) allows to modify the first disk label without reformatting the partition?
b) What’s the difference between both labels? Why does the label command ignore the first one after relabeling, whilst initially displaying it? Can there be more than one of the second version? Can it appear at varying offsets inside the partition (looks like)?
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 245
تاريخ: پنجشنبه
27 خرداد
1395 ساعت: 19:32