Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
Japheth

Homepage

Germany (South),
01.01.2021, 20:51
 

Current FreeDOS fdisk utility (Users)

I recently tried FreeDOS's fdisk utility on a real machine and, to say it carefully, IMO this tool needs to be improved.

There are currently 2 binaries delivered in the fdisk package:

- FDISK.EXE, version 1.2.1, dated 4/2003
- FDISK131.EXE, version 1.3.1, dated 11/2008

On the machine was installed a "normal" WD SATA 1TB HD.

Launching FDISK131, it just emits:
"Error reading Hard DIsk! Addressed sector not found"
and exits.

FDISK.EXE starts without error and allows to create a new (primary) partition ( I tried size 8192 MB), but it's unable to correctly calculate the starting sector, resulting in overlapping partitions:

BI  Type                     Sector    Size         MB abs. Start-End
-----------------------------------------------------------------------
80  83 Linux ext2fs                  2048 390701056 190772 2048-390703103
00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192 390703104-407480319
00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197 407472660-424260584


As it can be seen, partition 2 and 3 do overlapp, sectors 407,472,660-407,480,319 are part of both partitions.

A nasty bug: if "too much" data is written to partition 2, partition3's boot sector/FAT will be overwritten, causing the corresponding drive to "disappear".

Are there any newer versions or does FD v1.3 indeed supply such buggy versions of an elementary tool like FDISK? Hard to believe...

---
MS-DOS forever!

RayeR

Homepage

CZ,
01.01.2021, 23:45
(edited by RayeR, 02.01.2021, 01:07)

@ Japheth
 

Current FreeDOS fdisk utility

I also have Fdisk 1.3.1 as last version. I have 1TB HDD and don't see any errors on startup and it seems my partitions are displayed OK but didn't checked in detail. Couldn't be some problem in INT13h services of your BIOS?

How did you created other partitions and how does it look under another disk tool? I assume they are not really overlaping that's only FFdisk bad interpretation. I rather used PQmagic or similar tool so don't use this FFdisk much...

Update - how FFdisk sees my 1TB disk:

Current fixed disk drive: 2                  (TC: -9471 TH: 254 TS:  63)

Partition   Status   Mbytes   Description     Usage  Start Cyl  End Cyl
 D: 1   6      A       494   FAT16               0%       0        62
    2   5             7538   Extended            1%      63      1023
 M: 3  12           477126   FAT32     (LBA)    50%    1024      -3688
 N: 4  12           468709   FAT32     (LBA)    49%    -3687      -9472

---
DOS gives me freedom to unlimited HW access.

Japheth

Homepage

Germany (South),
02.01.2021, 02:54

@ RayeR
 

Current FreeDOS fdisk utility

> checked in detail. Couldn't be some problem in INT13h services of your
> BIOS?

No. My hdedit and other hd tool run fine.

> How did you created other partitions and how does it look under another
> disk tool?

I created the first partition with linux fdisk.

> I assume they are not really overlaping that's only FFdisk bad
> interpretation.

No, this error is real. I created 2 partitions on an 64 GB USB stick, the first a FAT16 with 2 GB, the second a FAT32 with 62 GB, and, after having written almost 2 GB to FAT16, the second drive showed garbage ( and "disappeared" after reboot ).

Also, Linux fdisk does detect those overlapping partitions and warns.

---
MS-DOS forever!

RayeR

Homepage

CZ,
02.01.2021, 03:17

@ Japheth
 

Current FreeDOS fdisk utility

> No, this error is real. I created 2 partitions on an 64 GB USB stick, the
> first a FAT16 with 2 GB, the second a FAT32 with 62 GB, and, after having
> written almost 2 GB to FAT16, the second drive showed garbage ( and
> "disappeared" after reboot ).
>
> Also, Linux fdisk does detect those overlapping partitions and warns.

Ouuu, that's bad, other FD users should be warned! How did look CHS values? but it shouldn't matter as it's beyond 8GB and FFdisk probably use LBA by default (instead of MSDOS 6.x Fdisk). I wonder why just 407 sectors, weird number...
Can you reproduce it on a sata/ide HDD or with i a bit different partition sizes? FreeDOS kernel displays some partition info at boot maybe it also perform overlaping check?

---
DOS gives me freedom to unlimited HW access.

Japheth

Homepage

Germany (South),
02.01.2021, 03:26

@ RayeR
 

Current FreeDOS fdisk utility

> I wonder why just 407 sectors, weird number...

That's a missunderstanding. I wrote:

sectors 407,472,660-407,480,319 are part of both partitions.

this is English large number notation, it should be read like this:

abs. sector numbers 407472660 up to 407480319 are part of both partitions.

Btw, does this forum software have no possibility to somehow select a fixed font?

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
02.01.2021, 12:44

@ Japheth
 

Current FreeDOS fdisk utility

> Btw, does this forum software have no possibility to somehow select a fixed
> font?

You can (ab)use the code tag for that.

---
Forum admin

Japheth

Homepage

Germany (South),
02.01.2021, 15:41

@ rr
 

Current FreeDOS fdisk utility

> You can (ab)use the code tag for that.

I did, but it's not really a monospaced font, it's just a bit "fixer" :-D .

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
05.01.2021, 21:46

@ Japheth
 

Current FreeDOS fdisk utility

> > You can (ab)use the code tag for that.
>
> I did, but it's not really a monospaced font, it's just a bit "fixer" :-D .

What are your requirements exactly? :-)

---
Forum admin

Japheth

Homepage

Germany (South),
06.01.2021, 11:03

@ rr
 

Current FreeDOS fdisk utility

> What are your requirements exactly? :-)

That tables look like tables :-D


80  83 Linux ext2fs                  2048 390701056 190772
00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192
00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197


I don't know how it looks in your browser, but in mine the columns are not
properly aligned (i.e. the column with items "2048", "390703104" and "407472660" should be right aligned).

---
MS-DOS forever!

tom

Homepage

Germany (West),
06.01.2021, 16:34

@ Japheth
 

Current FreeDOS fdisk utility

> > What are your requirements exactly? :-)
>
> That tables look like tables :-D
>
>
> 80  83 Linux ext2fs                  2048 390701056 190772
> 00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192
> 00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197
>

>
> I don't know how it looks in your browser, but in mine the columns are not
> properly aligned (i.e. the column with items "2048", "390703104" and
> "407472660" should be right aligned).

at least in Windows Firefox it is proper aligned;-)

which browser are you using?

ecm

Homepage E-mail

Düsseldorf, Germany,
06.01.2021, 16:54

@ tom
 

Forum monospaced font bug

> > > What are your requirements exactly? :-)
> >
> > That tables look like tables :-D
> >
> >
> > 80  83 Linux ext2fs                  2048 390701056 190772
> > 00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192
> > 00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197
> >

> >
> > I don't know how it looks in your browser, but in mine the columns are
> not
> > properly aligned (i.e. the column with items "2048", "390703104" and
> > "407472660" should be right aligned).
>
> at least in Windows Firefox it is proper aligned;-)
>
> which browser are you using?

Relevant: Forum bug: code block has non-monospaced font in mobile Firefox

---
l

Japheth

Homepage

Germany (South),
06.01.2021, 17:14

@ tom
 

Current FreeDOS fdisk utility

> which browser are you using?

It's FF, 78.6.0esr (64-bit), delivered with Debian 10.

I'm able to see tables correctly aligned if I go to preferences, find "Fonts and Colors", and then, clicking "Advanced...", select a monospaced font as proportional font.

I thought this sub-optimal, but just found out now, that, as long as I enable "allow pages to select their own fonts...", it works well enough.

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
07.01.2021, 23:49

@ Japheth
 

Current FreeDOS fdisk utility

> > which browser are you using?
>
> It's FF, 78.6.0esr (64-bit), delivered with Debian 10.
>
> I'm able to see tables correctly aligned if I go to preferences, find
> "Fonts and Colors", and then, clicking "Advanced...", select a monospaced
> font as proportional font.
>
> I thought this sub-optimal, but just found out now, that, as long as I
> enable "allow pages to select their own fonts...", it works well enough.

Why did you disable this before? :confused:
Can this bug be "closed" now?

---
Forum admin

ecm

Homepage E-mail

Düsseldorf, Germany,
08.01.2021, 00:04

@ rr
 

Current FreeDOS fdisk utility

> > > which browser are you using?
> >
> > It's FF, 78.6.0esr (64-bit), delivered with Debian 10.
> >
> > I'm able to see tables correctly aligned if I go to preferences, find
> > "Fonts and Colors", and then, clicking "Advanced...", select a
> monospaced
> > font as proportional font.
> >
> > I thought this sub-optimal, but just found out now, that, as long as I
> > enable "allow pages to select their own fonts...", it works well enough.
>
> Why did you disable this before? :confused:
> Can this bug be "closed" now?

No such setting on mobile Firefox.

---
l

mceric

Germany,
08.01.2021, 01:18

@ rr
 

Current FreeDOS fdisk utility

> > > which browser are you using?
> >
> > It's FF, 78.6.0esr (64-bit), delivered with Debian 10.
> >
> > I'm able to see tables correctly aligned if I go to preferences, find
> > "Fonts and Colors", and then, clicking "Advanced...", select a
> monospaced
> > font as proportional font.
> >
> > I thought this sub-optimal, but just found out now, that, as long as I
> > enable "allow pages to select their own fonts...", it works well enough.
>
> Why did you disable this before? :confused:
> Can this bug be "closed" now?

That seems to be a misunderstanding. Japheth was forced to either tell his browser to use a typewriter (monospaced) font even for things which would otherwise be using a normal, proportional font. Or he has to allow websites to use fully custom fonts, as far as I understand his comment.

That is not the best solution to the problem. Just a tedious workaround. The forum should work in a way which only tells the browser to use a monospace font. Without the requirement to let the website (BTTR) select which font exactly to use. I hope the website at least does not tell the browser to download fonts somewhere? That would be the most annoying solution, but some websites do this for "perfect" styling :-p

Still, I can say that table alignment on BTTR is okay with newer Firefox versions, so the bug seems to be specific to the version used by Japheth.

PS: I wonder why FDISK tries to win obfuscation contests.

---
FreeDOS / DOSEMU2 / ...

rr

Homepage E-mail

Berlin, Germany,
08.01.2021, 22:21

@ mceric
 

Current FreeDOS fdisk utility

> > > I'm able to see tables correctly aligned if I go to preferences, find
> > > "Fonts and Colors", and then, clicking "Advanced...", select a
> > monospaced
> > > font as proportional font.
> > >
> > > I thought this sub-optimal, but just found out now, that, as long as I
> > > enable "allow pages to select their own fonts...", it works well
> enough.
> >
> > Why did you disable this before? :confused:
> > Can this bug be "closed" now?
>
> That seems to be a misunderstanding. Japheth was forced to either tell his
> browser to use a typewriter (monospaced) font even for things which would
> otherwise be using a normal, proportional font. Or he has to allow websites
> to use fully custom fonts, as far as I understand his comment.

The latter is the default setting in Firefox and other standard browsers. That's why I asked, why he disabled this setting in the past.

> That is not the best solution to the problem. Just a tedious workaround.
> The forum should work in a way which only tells the browser to use a
> monospace font.

This is what it does with the <code> tag, as tom already pointed out.

> Without the requirement to let the website (BTTR) select which font
> exactly to use.

But that's how the WWW worked for decades. The forum uses "font-family: courier-new, courier;" for <code>. Both fonts are widely used. If these fonts are not available on the user's computer, then the user's browser has a fallback mechanism to use a similar font instead.

> I hope the website at least does not tell the browser to download fonts
> somewhere?

It does not. See https://www.bttr-software.de/forum/style.css for the fonts used.

> That would be the most annoying solution, but some websites do this for
> "perfect" styling :-p

I know. And these downloads are sometimes larger than what fits on a 3.5" floppy. :-(

---
Forum admin

mceric

Germany,
09.01.2021, 01:49

@ rr
 

Current FreeDOS fdisk utility

> But that's how the WWW worked for decades. The forum uses "font-family:
> courier-new, courier;" for <code>.
>
> It does not. See https://www.bttr-software.de/forum/style.css for the fonts
> used.

That could be the problem: You ONLY mention explicit, non-generic names for code, while for the normal text, you also mention the generic "sans-serif" after "arial or verdana".

https://www.w3schools.com/cssref/css_websafe_fonts.asp (where you can also see what it looks like) recommends:

Arial, Verdana, Helvetica, Tahoma or Trebuchet MS for sans-serif
Times New Roman, Georgia or Garamond for serif
Courier New for monospace and
Brush Script MT for cursive.

So I suggest to use "font-family: courier-new, courier, monospace;" for <code>.

Edit: Looks like that is what you have done when you said "you have changed the CSS a little". So we agree and have to wait for Japheth to check whether it helped.

PS: You say FDISK overflows for disks above 1 TB (above 2^31 sectors)? Not good at all!

---
FreeDOS / DOSEMU2 / ...

Japheth

Homepage

Germany (South),
08.01.2021, 05:05

@ rr
 

Current FreeDOS fdisk utility

> Why did you disable this before? :confused:

I did not "disable" anything. All I changed is to select a monospaced font as "proportional" font. I first thought that this may make look all websites terrible, but actually it's hardly noticeable.

> Can this bug be "closed" now?

Yes. If the bug is indeed restricted to the ff version that debian 10 provides it will become obsolete as soon as debian 11 becomes "stable".

---
MS-DOS forever!

tom

Homepage

Germany (West),
08.01.2021, 13:53

@ Japheth
 

Current FreeDOS fdisk utility

> Yes. If the bug is indeed restricted to the ff version that debian 10
> provides it will become obsolete as soon as debian 11 becomes "stable".

the table is surrounded by
<code>
table
</code>

according to 15 seconds of internet research,

"The <code> tag is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font."

and that is what you wanted.

how your browser interprets this is beyond the forums possibility to influence;-)

Japheth

Homepage

Germany (South),
08.01.2021, 22:51

@ tom
 

Current FreeDOS fdisk utility

> how your browser interprets this is beyond the forums possibility to
> influence;-)

May be. But my guess is that putting the <code> tags inside a <pre> block would make the issues with "non breaking spaces" disappear.

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
08.01.2021, 23:24

@ Japheth
 

BBCode code tag

> > how your browser interprets this is beyond the forums possibility to
> > influence;-)
>
> May be. But my guess is that putting the <code> tags inside a <pre> block
> would make the issues with "non breaking spaces" disappear.

At first, let's try something else: I changed the CSS a little. Please tell me your results. (Make sure to clear your browser's cache first.)

---
Forum admin

Japheth

Homepage

Germany (South),
09.01.2021, 05:24

@ rr
 

BBCode code tag

> At first, let's try something else: I changed the CSS a little. Please tell
> me your results. (Make sure to clear your browser's cache first.)

if this:


+---------+---------+---------+---------+---------+---------+---------+---------+
|         |         |         |         |         |         |         |         |         
+---------+---------+---------+---------+---------+---------+---------+---------+
|         |         |         |         |         |         |         |         |         
+---------+---------+---------+---------+---------+---------+---------+---------+


looks like 2 lines of 8 rectangles then it's mostly ok (mostly, because I'm limited to 8 rectangles, if I enter more, it rejects them [ error: the word ... in the text field is too long ].

Here's once more the table displayed by the mbr tool:

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size      MB
-------------------------------------------------------------------------------
80 0c Prim. DOS,FAT32,LBA     0/  1/ 1  521/254/63         63    8385867   4094
00 07 HPFS,NTFS,exFAT       522/  0/ 1  542/254/63    8385930  115491285  56392
00 07 HPFS,NTFS,exFAT       543/  0/ 1 1002/254/63  123877215  204796620  99998
00 05 Extended DOS         1003/  0/ 1    0/254/63  328675326  921588402 449994

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
09.01.2021, 19:56

@ Japheth
 

BBCode code tag

Now I can test, how it looks in my browser, but I'm interested in how it looks in your Debian's FireFox.

---
Forum admin

Japheth

Homepage

Germany (South),
10.01.2021, 02:22

@ rr
 

BBCode code tag

> ... but I'm interested in how it looks in your Debian's FireFox.

Oh, I forgot to mention: with debian 10 FF ( and the font setting restored to the default ), I can see both the nice 16 rectangles and the properly aligned MBR table header. :-)

Fantastic work, admin - I love you! ;-)

---
MS-DOS forever!

rr

Homepage E-mail

Berlin, Germany,
10.01.2021, 15:16

@ Japheth
 

BBCode code tag

> > ... but I'm interested in how it looks in your Debian's FireFox.
>
> Oh, I forgot to mention: with debian 10 FF ( and the font setting restored
> to the default ), I can see both the nice 16 rectangles and the properly
> aligned MBR table header. :-)

Nice. :ok:

> Fantastic work, admin - I love you! ;-)

Love you too. :lol3:

---
Forum admin

rr

Homepage E-mail

Berlin, Germany,
08.01.2021, 22:02

@ Japheth
 

Current FreeDOS fdisk utility

> > Why did you disable this before? :confused:
>
> I did not "disable" anything. All I changed is to select a monospaced font
> as "proportional" font. I first thought that this may make look all
> websites terrible, but actually it's hardly noticeable.

Your sentence I thought this sub-optimal, but just found out now, that, as long as I enable "allow pages to select their own fonts...", it works well enough. made me think, that you re-enabled the "Allow pages to choose their own fonts" option now and all looks fine.

> > Can this bug be "closed" now?
>
> Yes. If the bug is indeed restricted to the ff version that debian 10
> provides it will become obsolete as soon as debian 11 becomes "stable".

Okay. Then let's wait for Debian 11.

---
Forum admin

glennmcc

Homepage E-mail

North Jackson, Ohio (USA),
06.01.2021, 19:01

@ Japheth
 

Current FreeDOS fdisk utility

> > What are your requirements exactly? :-)
>
> That tables look like tables :-D
>
>
> 80  83 Linux ext2fs                  2048 390701056 190772
> 00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192
> 00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197
>

>
> I don't know how it looks in your browser, but in mine the columns are not
> properly aligned (i.e. the column with items "2048", "390703104" and
> "407472660" should be right aligned).

Here now with Linux FireFox v68.12.0esr
the columns are correctly aligned.

BRB with DOS Arachne v1.97

---
--
http://glennmcc.org/

glennmcc

Homepage E-mail

North Jackson, Ohio (USA),
06.01.2021, 19:17

@ glennmcc
 

Current FreeDOS fdisk utility

> > > What are your requirements exactly? :-)
> >
> > That tables look like tables :-D
> >
> >
> > 80 83 Linux ext2fs 2048 390701056 190772
> > 00 0c Prim. DOS (FAT32,LBA) 390703104 16777216 8192
> > 00 0c Prim. DOS (FAT32,LBA) 407472660 16787925 8197
> >

> >
> > I don't know how it looks in your browser, but in mine the columns are
> not
> > properly aligned (i.e. the column with items "2048", "390703104" and
> > "407472660" should be right aligned).
>
> Here now with Linux FireFox v68.12.0esr
> the columns are correctly aligned.
>
> BRB with DOS Arachne v1.97


Also no problem....

http://glennmcc.org/images/correctly_aligned.jpg

---
--
http://glennmcc.org/

rr

Homepage E-mail

Berlin, Germany,
08.01.2021, 23:52

@ RayeR
 

Current FreeDOS fdisk utility

> Update - how FFdisk sees my 1TB disk:
>
> Current fixed disk drive: 2                  (TC: -9471 TH: 254 TS:
> 63)
>
> Partition   Status   Mbytes   Description     Usage  Start Cyl  End Cyl
> D: 1   6      A       494   FAT16               0%       0        62
> 2   5             7538   Extended            1%      63      1023
> M: 3  12           477126   FAT32     (LBA)    50%    1024      -3688
> N: 4  12           468709   FAT32     (LBA)    49%    -3687     
> -9472


Negative values for Start/End Cyl? :confused:

---
Forum admin

boeckmann

Aachen, Germany,
22.03.2023, 15:45

@ rr
 

Current FreeDOS fdisk utility

> > Update - how FFdisk sees my 1TB disk:
> >
> > Current fixed disk drive: 2                  (TC: -9471 TH: 254 TS:
>
> > 63)
> >
> > Partition   Status   Mbytes   Description     Usage  Start Cyl  End Cyl
> >  D: 1   6      A       494   FAT16               0%       0        62
> >     2   5             7538   Extended            1%      63      1023
> >  M: 3  12           477126   FAT32     (LBA)    50%    1024      -3688
> >  N: 4  12           468709   FAT32     (LBA)    49%    -3687     
> > -9472

>
> Negative values for Start/End Cyl? :confused:

Should be fixed by v1.3.5 :-)

kerravon

Ligao, Free World North,
24.03.2023, 02:28

@ boeckmann
 

Current FreeDOS fdisk utility

On the subject of partitioning utilities, there is parted here:

https://git.candlhat.org/

which partitions a disk image.

If you are running under an OS that supports
treating a real hard disk as a file (as PDOS
does), then it can be used to partition a
real hard disk.

All that is required is a C90 compiler.

Code is public domain and the author is responsive
to any bug reports.

BFN. Paul.

tom

Homepage

Germany (West),
24.03.2023, 18:47

@ kerravon
 

Current FreeDOS fdisk utility

> On the subject of partitioning utilities, there is parted here:

the subject is "Current FreeDOS fdisk utility", not "partitioning utilities".

could you please spam some other forum?

tom

Homepage

Germany (West),
24.03.2023, 18:49

@ kerravon
 

Current FreeDOS fdisk utility

> On the subject of partitioning utilities, there is parted here:

the subject is "Current FreeDOS fdisk utility", not "partitioning utilities".

could you please spam some other forum?

edited to add: or at least create a new thread?

Rugxulo

Homepage

Usono,
25.03.2023, 03:18

@ tom
 

Current FreeDOS fdisk utility

> > On the subject of partitioning utilities, there is parted here:
>
> the subject is "Current FreeDOS fdisk utility", not "partitioning
> utilities".
>
> could you please spam some other forum?
>
> edited to add: or at least create a new thread?

It seems to have two repositories:

* dosfstools
* parted

Presumably the first one has code that could potentially be shared, e.g. mkfs.c.

rr

Homepage E-mail

Berlin, Germany,
02.01.2021, 12:50

@ Japheth
 

Current FreeDOS fdisk utility

> Are there any newer versions or does FD v1.3 indeed supply such buggy

I'm not aware of any.

> versions of an elementary tool like FDISK? Hard to believe...

Doesn't matter, what I believe on FDISK, because I don't use it very often. But I guess, there are many other bugs in FreeDOS. Reporting issues and fixing these happens very "asynchronously", to say nice, which disattracts many people.

---
Forum admin

mceric

Germany,
02.01.2021, 16:13

@ rr
 

Current FreeDOS fdisk utility - other FreeDOS bugs and fixes

> Doesn't matter, what I believe on FDISK, because I don't use it very often.
> But I guess, there are many other bugs in FreeDOS. Reporting issues and
> fixing these happens very "asynchronously", to say nice, which disattracts
> many people.

Instead of spitting bitterness at FreeDOS (happy new year to you, too?) you could at least tell which of the reported but unfixed bugs annoy you most and where to find the bug report lists.

There are 229 bugs listed here:

https://sourceforge.net/p/freedos/bugs/?limit=250

Unfortunately, they are not grouped into affected
applications / distros / maintainers / anything??

While most sources mirrored at

https://github.com/fdos

claim to have zero issues. Exceptions:

https://github.com/FDOS/kernel/issues

* ecm wants a ZIP of the releases
* yuppox says "wmake?"
* petr-akhlamov has a problem with russian codepage

https://github.com/FDOS/freecom/issues

* Russian translations have spelling errors
* line-wrapping when using up-arrow history
* internal commands do not set errorlevel (should they?)
* French translations have room for improvement
* Same for Turkish translation
* FreeCOM fails to use int 21.6505 file name terminators (RxDOS compat)
* Improvements in a fork, see below
* Fritz Mueller wants COPY to mention target paths, not just drives (and some other issues)

The improvements by Piotr Durlej - it also lists all other
GIT based changes for the last centuries, but there was a
period of only 3 changes between 2011-07-29 and 2018-01-07:

https://github.com/p-durlej/freedos-freecom/commits/master

* the thing Fritz wanted for COPY
* a similar change for DEL
* TYPE tuning
* DIR support for 40 column mode
* improved English texts
* GCC compile support and other compile tricks
* CLS versus ctrl-L

Before that, there are 2019-12-29 changes by Bart Oldeman
and other older changes which hopefully are already used
more widely (0.84pre7) by the general FreeDOS audience?

---
FreeDOS / DOSEMU2 / ...

ecm

Homepage E-mail

Düsseldorf, Germany,
02.01.2021, 17:21

@ mceric
 

Current FreeDOS fdisk utility - other FreeDOS bugs and fixes

>
> https://github.com/FDOS/freecom/issues
>
> * FreeCOM fails to use int 21.6505 file name terminators (RxDOS compat)

The title of https://github.com/FDOS/freecom/issues/20 is "FreeCOM fails to match any commands in RxDOS 7.24 due to unsupported Int21.6505". Your reading does not match the contents however. FreeCOM *does* use that service. It depends on that service being implemented to work properly. The "unsupported" bit here is that current RxDOS does not yet provide this service, causing FreeCOM to fail.

---
l

mceric

Germany,
02.01.2021, 20:23

@ ecm
 

Current FreeDOS fdisk utility - other FreeDOS bugs and fixes

> >
> > https://github.com/FDOS/freecom/issues
> >
> > * FreeCOM fails to use int 21.6505 file name terminators (RxDOS compat)
>
> The title of https://github.com/FDOS/freecom/issues/20 is "FreeCOM fails to
> match any commands in RxDOS 7.24 due to unsupported Int21.6505". Your
> reading does not match the contents however. FreeCOM *does* use that
> service. It depends on that service being implemented to work properly. The
> "unsupported" bit here is that current RxDOS does not yet provide this
> service, causing FreeCOM to fail.

In that case, RxDOS is not MS DOS 3.3 compatible, which
is not a bug in FreeCOM - it does not intend to work
with even older MS DOS versions, as far as I remember?

FreeCOM should probably specify system requirements, though.

---
FreeDOS / DOSEMU2 / ...

tom

Homepage

Germany (West),
09.01.2021, 19:56

@ mceric
 

Current FreeDOS fdisk utility - other FreeDOS bugs and fixes

> FreeCOM should probably specify system requirements, though.

yes of course. FreeCOM requires a DOS-compatible operating system.

mceric

Germany,
10.01.2021, 00:40

@ tom
 

Current FreeDOS fdisk utility - other FreeDOS bugs and fixes

> > FreeCOM should probably specify system requirements, though.
>
> yes of course. FreeCOM requires a DOS-compatible operating system.

Of course I mean "FreeCOM docs should tell you which DOS version
you have to have at minimum". I remember that it can gracefully
adapt to whether or not you have FAT32 support or LFN, but I do
not know whether it is supposed to work smoothly on DOS versions
which are not at least MS DOS 3.3/newer compatible, for example.

---
FreeDOS / DOSEMU2 / ...

Japheth

Homepage

Germany (South),
02.01.2021, 15:39

@ Japheth
 

Current FreeDOS fdisk utility

> Launching FDISK131, it just emits:
> "Error reading Hard DIsk! Addressed sector not found"
> and exits.

Here's good news: this error can be cured. It happens if FDISK131 doesn't find its FDISK.INI file (strangely, it's claimed that this file is "optional").

The bad news is: The error concerning partition overlap has NOT been fixed in v1.3.1.

---
MS-DOS forever!

marcov

02.01.2021, 16:56

@ Japheth
 

Current FreeDOS fdisk utility

> On the machine was installed a "normal" WD SATA 1TB HD.

What is "normal" ? Non advanced format?

https://en.wikipedia.org/wiki/Advanced_Format

Japheth

Homepage

Germany (South),
03.01.2021, 11:16

@ Japheth
 

Bug confirmed

I again played a bit with FD fdisk. Here's again the 2 overlapping partitions:


  type          start sec  size            abs. sectors   
> FAT32,LBA     390703104  16777216   8192 390703104-407480319
> FAT32,LBA     407472660  16787925   8197 407472660-424260584


Now, one missing information is the geometry returned by Int 0x13, ah=0x48:

Cyl/Head/Sec=121601/255/63

This gives a good hint where the problem is:

1. Multiplying "heads" and "sectors": 255x63=16065
2. Dividing the 2. start sector thru this value: 407472660/16065=25364

The division has no remainder. And so I conclude: FD fdisk tries to align the partition's start sector (and size) to a "cylinder" boundary, either rounding or skipping remainders. This indeed works - as long as FD fdisk handles the MBR exclusively. Linux fdisk, however, doesn't seem to care about cylinder boundaries, at least not if the partition type is FAT32-LBA.

Another - minor - problem with FD fdisk's approach is that the cyl/head/sec geometry returned by Int 0x13, ah=0x48 may be invalid. There's a flag returned, indicating whether the information is valid, but FD fdisk ignores it

Here's the relevant fdisk source, file PDISKIO.C:


    asm {
      mov ah,0x48
      mov dl,BYTE PTR physical_drive
      mov ds,result_buffer_segment
      mov si,result_buffer_offset
      int 0x13

      mov BYTE PTR error_code,ah
      }

//    if(error_code>0) return(error_code);
    if(error_code > 0) Error_Handler(error_code);

    /* Compute the total number of logical cylinders based upon the number */
    /* of physical sectors returned from service 0x48.                     */

    number_of_physical_sectors = *(_u32*)(result_buffer+16);

    total_cylinders=((number_of_physical_sectors/total_sectors)/(total_heads+1));

---
MS-DOS forever!

tom

Homepage

Germany (West),
03.01.2021, 15:45

@ Japheth
 

Bug confirmed

> I again played a bit with FD fdisk. Here's again the 2 overlapping
> partitions:
>
>
> type          start sec  size            abs. sectors   
> > FAT32,LBA     390703104  16777216   8192 390703104-407480319
> > FAT32,LBA     407472660  16787925   8197 407472660-424260584
>


is it correct that the 1st partition was created by linux, the 2nd by FDISK?

>
> Now, one missing information is the geometry returned by Int 0x13,
> ah=0x48:
>
> Cyl/Head/Sec=121601/255/63
>
> This gives a good hint where the problem is:
>
> 1. Multiplying "heads" and "sectors": 255x63=16065
> 2. Dividing the 2. start sector thru this value: 407472660/16065=25364
>
> The division has no remainder. And so I conclude: FD fdisk tries to align
> the partition's start sector (and size) to a "cylinder" boundary, either
> rounding or skipping remainders. This indeed works - as long as FD fdisk
> handles the MBR exclusively. Linux fdisk, however, doesn't seem to care
> about cylinder boundaries, at least not if the partition type is
> FAT32-LBA.

most likely correct; DOS for historical reasons aligns partitions on track boundaries, linux and newer windows on 4K or 1M boundaries.

of course this is a FDISK bug; it should round up the 1st partition and not down.

Japheth

Homepage

Germany (South),
03.01.2021, 20:40

@ tom
 

Bug confirmed

> is it correct that the 1st partition was created by linux, the 2nd by
> FDISK?

it's actually the 2nd and 3rd partition, the first is an ext4. Partition 1 & 2 were created by linux, the 3rd by FD fdisk.

---
MS-DOS forever!

tom

Homepage

Germany (West),
06.01.2021, 17:31

@ Japheth
 

Bug confirmed

> The division has no remainder. And so I conclude: FD fdisk tries to align
> the partition's start sector (and size) to a "cylinder" boundary, either
> rounding or skipping remainders. This indeed works - as long as FD fdisk
> handles the MBR exclusively. Linux fdisk, however, doesn't seem to care
> about cylinder boundaries, at least not if the partition type is
> FAT32-LBA.

after taking a look into FDISKs code (PCOMPUTE.C, create_primary_partition() and Determine_Free_Space() )

a) it's really ugly code
b) it looks ok in this respect;
at least it tries to start the next partition at the
end cylinder of the previous partition + 1.
this should automatically round up.
at least that's what I see.
c) all calculations are done with cylinders, with sector=1, head=0.
c) this is a candidate for obfuscated C code contest.


could you post a dump of the partition table or verify yourself if the
ending cylinder of the 2'nd partition corresponds to the LBA value.

Japheth

Homepage

Germany (South),
06.01.2021, 18:16

@ tom
 

Bug confirmed

> could you post a dump of the partition table

I'll dump the partition table of a 64GB USB memory stick, because the math is easier. The stick's first partition is a FAT16, created with linux fdisk. The second (primary,FAT32) partition was created with FD fdisk 1.2.1, using the remaining space.

Here's the MBR dump:

Drive 2: EDD-Version=30 API-Bitmap=5
ExInt13: Flags=0006 Sectors=124825600 (60950 MB) SecSize=512 [CHS=60950/64/32]
EDD3: bus=PCI interface=USB bus/dev/func=1/0/0

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size      MB  abs. Start/End
-----------------------------------------------------------------------------------------------
80 0e Prim. DOS,FAT16,LBA     0/  1/ 1  975/ 63/32         32    4096000   2000 32-4096031
00 0c Prim. DOS,FAT32,LBA   976/  0/ 1  534/ 63/32    4096000  120731648  58951
00 00 Free Entry              0/  0/ 0    0/  0/ 0          0          0      0
00 00 Free Entry              0/  0/ 0    0/  0/ 0          0          0      0


one "cylinder" is 2048 sectors or 1 MB.
The overlapping part in this case is 32 sectors only, start sector of second partition should be 4096032.
Interestingly, size of the second partition is 120631648 (58951 cylinder), and that exceeds the stick's capacity by one cylinder!

> if the ending cylinder of the 2'nd partition corresponds to the LBA value.

But the ending cylinder is limited to 1023 and so cannot correspond to the LBA value.

---
MS-DOS forever!

RayeR

Homepage

CZ,
16.01.2021, 05:14
(edited by RayeR, 16.01.2021, 05:57)

@ Japheth
 

Bug confirmed

Would't you try to compare the partition creation using MS-DOS 6.2x FDISK (on smaller partition) if it lead to same problem?

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size     MB  abs. Start/End
----------------------------------------------------------------------------------------------
80 0e Prim. DOS,FAT16,LBA     0/  1/ 1  975/ 63/32         32    4096000  2000 32-4096031
00 0c Prim. DOS,FAT32,LBA   976/  0/ 1  534/ 63/32    4096000  120731648 58951

Well I see the problem here. It's tricky that cylinder value already overflows 10bit storage in partition entry. One simple approach would be to start next partition just by incrementing the cylinder of previous end value (975+1)&0x3FF=976. Other approach would be to calculate CHS from LBA value. Last LBA is 4096031 so next partition should start at LBA 4096032 or further. If one do simple calculation like 4096032/64/32=2000.015625 and truncate it to 2000 then & 3FF = 976 and things goes wrong. It should check the reminder and round up to 2001 then & 3FF = 977. Back to LBA it would give 4098048 so ~1MB wasted gap but better than overlap.

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
16.01.2021, 12:01

@ RayeR
 

Bug confirmed

> Would't you try to compare the partition creation using MS-DOS 6.2x FDISK
> (on smaller partition) if it lead to same problem?
>
> BI Type                    Start-C/H/S   End-C/H/S     Sector     Size   
> MB  abs. Start/End
> ----------------------------------------------------------------------------------------------
> 80 0e Prim. DOS,FAT16,LBA     0/  1/ 1  975/ 63/32         32    4096000
> 2000 32-4096031
> 00 0c Prim. DOS,FAT32,LBA   976/  0/ 1  534/ 63/32    4096000  120731648
> 58951
>

> Well I see the problem here. It's tricky that cylinder value already
> overflows 10bit storage in partition entry. One simple approach would be to
> start next partition just by incrementing the cylinder of previous end
> value (975+1)&0x3FF=976.

fortunately, this is not the way FDISK works. all internal work is done with (unfortunately signed) 32 bit cylinders.
otherwise, it would have failed much earlier.

> Other approach would be to calculate CHS from LBA
> value. Last LBA is 4096031 so next partition should start at LBA 4096032 or
> further. If one do simple calculation like 4096032/64/32=2000.015625 and
> truncate it to 2000 then & 3FF = 976 and things goes wrong. It should check
> the reminder and round up to 2001 then & 3FF = 977. Back to LBA it would
> give 4098048 so ~1MB wasted gap but better than overlap.


impressive insights.
however, FDISK already tries to work this way; I'm simply not able to spot where it fails.

rr

Homepage E-mail

Berlin, Germany,
07.01.2021, 23:48

@ tom
 

Bug confirmed

> c) all calculations are done with cylinders, with sector=1, head=0.
> c) this is a candidate for obfuscated C code contest.

Is two times "c)" for obfuscation? :-D

---
Forum admin

tom

Homepage

Germany (West),
10.01.2021, 19:10
(edited by tom, 11.01.2021, 00:25)

@ Japheth
 

Current FreeDOS fdisk utility

> I recently tried FreeDOS's fdisk utility on a real machine and, to say it
> carefully, IMO this tool needs to be improved.

definitively!

>
> There are currently 2 binaries delivered in the fdisk package:
>
> - FDISK.EXE, version 1.2.1, dated 4/2003
> - FDISK131.EXE, version 1.3.1, dated 11/2008

that's a bug by itself.
by what criteria are users expected to choose the right one? :-( :-( :-(

> On the machine was installed a "normal" WD SATA 1TB HD.
>
> Launching FDISK131, it just emits:
> "Error reading Hard DIsk! Addressed sector not found"
> and exits.
most likely due to
  VERSION W98
in the (missing) .INI file. if this is not set, during initialization

  if( (flags.version==W95) || (flags.version==W95B) || (flags.version==W98) )
   Check_For_INT13_Extensions();

and later it is not able to access some sectors above 2GB and (correctly) exits due to disk I/O error. better save than sorry.

>
> FDISK.EXE starts without error and allows to create a new (primary)
> partition ( I tried size 8192 MB), but it's unable to correctly calculate
> the starting sector, resulting in overlapping partitions:
>
> BI  Type                     Sector    Size         MB abs.
> Start-End
> -----------------------------------------------------------------------
> 80  83 Linux ext2fs                  2048 390701056 190772 2048-390703103
> 00  0c Prim. DOS (FAT32,LBA)    390703104  16777216   8192
> 390703104-407480319
> 00  0c Prim. DOS (FAT32,LBA)    407472660  16787925   8197
> 407472660-424260584

>
> As it can be seen, partition 2 and 3 do overlapp, sectors
> 407,472,660-407,480,319 are part of both partitions.

I still haven't found the precise bug location, but the problem seems to be:

FDISK does all inner computations with cylinders, and simply assumes heads=0 sector = 1.

even reading the partition table, head and sector are basically ignored

Read_Partition_Tables()
{
...
          pDrive->pri_part[index].start_sect=1;
          pDrive->pri_part[index].start_cyl
           =Extract_Cylinder_From_LBA_Value(
           pDrive->pri_part[index].rel_sect
           ,pDrive->pri_part[index].start_head
           ,pDrive->pri_part[index].start_sect
           ,pDrive->total_head
           ,pDrive->total_sect);

          pDrive->pri_part[index].end_head=pDrive->total_head;
          pDrive->pri_part[index].end_sect=pDrive->total_sect;
          pDrive->pri_part[index].end_cyl
           =Extract_Cylinder_From_LBA_Value(
           /* */
           (pDrive->pri_part[index].rel_sect
           +pDrive->pri_part[index].num_sect)
           ,pDrive->pri_part[index].end_head
           ,pDrive->pri_part[index].end_sect
           ,pDrive->total_head
           ,pDrive->total_sect);


now in your partition table,

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size      MB  abs. Start/End
-----------------------------------------------------------------------------------------------
80 0e Prim. DOS,FAT16,LBA     0/  1/ 1  975/ 63/32         32    4096000   2000 32-4096031
00 0c Prim. DOS,FAT32,LBA   976/  0/ 1  534/ 63/32    4096000  120731648  58951
00 00 Free Entry              0/  0/ 0    0/  0/ 0          0          0      0
00 00 Free Entry              0/  0/ 0    0/  0/ 0          0          0      0


the FDISK cylinder is one larger than the ending cylinder of the first partition.

yes, this is a bug. unfortunately fixing this would probably require a major code change. should be possible.

the real problem here is that code changes in partition creating/deleting/whatever code is dangerous stuff as this risks losing data.

my recommendation: stop using FDISK. there are better alternatives anyway.

Japheth

Homepage

Germany (South),
11.01.2021, 11:49

@ tom
 

Current FreeDOS fdisk utility

> that's a bug by itself.
> by what criteria are users expected to choose the right one? :-( :-( :-(

Somewhat hidden (in file NEWS.TXT) there's an explanation:

Current Stable Production Release: 1.2.1
Current Beta Release: 1.3.1

> yes, this is a bug. unfortunately fixing this would probably require a
> major code change. should be possible.

I don't think a "major code change" is necessary. fdisk may remain focused on "cylinders", wasting 1 or 2 MBs. That won't hurt.

> the real problem here is that code changes in partition
> creating/deleting/whatever code is dangerous stuff as this risks losing
> data.
> my recommendation: stop using FDISK. there are better alternatives anyway.

Well, yes, of course, but the current status is that the risk already exists.
Even if the bug won't be fixed and recommended to use another tool for partitioning, there still exist potential data losses due to the usage of FD fdisk in the past 15-20 years. Is this to be ignored? Wouldn't it at least be necessary to supply a tool that detects those overlaps and warns the user?

---
MS-DOS forever!

mceric

Germany,
11.01.2021, 14:16

@ Japheth
 

Current FreeDOS fdisk utility

> Even if the bug won't be fixed and recommended to use another tool for
> partitioning, there still exist potential data losses due to the usage of
> FD fdisk in the past 15-20 years. Is this to be ignored? Wouldn't it at
> least be necessary to supply a tool that detects those overlaps and warns
> the user?

That sounds like a great idea. It could even mark the affected clusters as broken to prevent using them. FDISK itself should probably show a big warning when it sees overlap, but I do not know whether just truncating the overlapping partition would not cause too many side effects itself. At the very least, DOS
will be upset about mismatching partition and filesystem (boot sector data) sizes.

Also thanks to everybody who is investigating what and why FDISK messes up!

---
FreeDOS / DOSEMU2 / ...

tom

Homepage

Germany (West),
11.01.2021, 20:11

@ mceric
 

Current FreeDOS fdisk utility

> > Even if the bug won't be fixed and recommended to use another tool for
> > partitioning, there still exist potential data losses due to the usage
> of
> > FD FDISK in the past 15-20 years. Is this to be ignored? Wouldn't it at
> > least be necessary to supply a tool that detects those overlaps and
> warns
> > the user?
>
> That sounds like a great idea. It could even mark the affected clusters as
> broken to prevent using them.

it's a bit demanding to mark clusters in EXTFS/NTFS/BTTRFS partitions as broken to avoid overwriting a broken FAT partition.

anyway: when would such a tool be used, even if it existed?
after partitions have been set up, FDISK will typically never be used again.

at update time? typically every 5-10 years?

IMO the right point to check this would be in the kernel at INIT time.
it scans the partition tables anyway.

adding code to check for overlap between any partition and any other partition (including unknown partition types) is trivially a N^2 operation, certainly acceptable at init time.

and the kernel InitDisk code is executed regularly. printing a warning would be easy, and helpful.

and it would be really interesting to learn what Windows/Linux to with such damaged partitions.

Ringding

13.01.2021, 12:09

@ tom
 

Current FreeDOS fdisk utility

> and it would be really interesting to learn what Windows/Linux to with such
> damaged partitions.

I remember encountering this somehow with CentOS 7 bootable USB images. They had the EFI partition, which is basically a FAT file system, embedded as an image file inside the ISO image, and in the partition table a separate entry would carefully reference this image inside the larger data partition.

rr

Homepage E-mail

Berlin, Germany,
11.01.2021, 18:12

@ Japheth
 

Current FreeDOS fdisk utility

> Well, yes, of course, but the current status is that the risk already
> exists.
> Even if the bug won't be fixed and recommended to use another tool for
> partitioning, there still exist potential data losses due to the usage of
> FD fdisk in the past 15-20 years. Is this to be ignored? Wouldn't it at
> least be necessary to supply a tool that detects those overlaps and warns
> the user?

Such a tool should be included in every new FreeDOS release then. It should become part of the install/upgrade process to check for overlapping.

---
Forum admin

tom

Homepage

Germany (West),
11.01.2021, 19:57

@ Japheth
 

Current FreeDOS fdisk utility

> > that's a bug by itself.
> > by what criteria are users expected to choose the right one? :-( :-( :-(
>
>
> Somewhat hidden (in file NEWS.TXT) there's an explanation:
>
> Current Stable Production Release: 1.2.1
> Current Beta Release: 1.3.1
>
> > yes, this is a bug. unfortunately fixing this would probably require a
> > major code change. should be possible.
>
> I don't think a "major code change" is necessary. fdisk may remain focused
> on "cylinders", wasting 1 or 2 MBs. That won't hurt.
it's certainly not about 1 or 2 MBs.

I think I understand the problem now, and it's not easy to fix.

for ease of arithmetic, assume a cylinder size of 1000 sectors.

if an existing 4500 sector partition extends from 5200 to 9700, FDISK will "round down" this partition to 5000 through 9999, will create the next partition at 10000, and everybody is happy.

if an existing 4500 sector partition extends from 5600 to 10100, FDISK will "round down" this partition to 5000 through 9999, will create the next partition at 10000, and everybody is unhappy (sooner or later).

this error comes up similarly when calculating available space before/after/between partitions.

good luck coming up with an efficient solution.


IMO the only way to fix this is to transform the code to use sectors, not cylinders. and that's a major transformation.

or use either FDISK exclusively, or use your Linux/windows/pqmagic partitioner only.

mceric

Germany,
11.01.2021, 22:20

@ tom
 

Current FreeDOS fdisk utility

> I think I understand the problem now, and it's not easy to fix.
>
> for ease of arithmetic, assume a cylinder size of 1000 sectors.
>
> if an existing 4500 sector partition extends from 5200 to 9700, FDISK will
> "round down" this partition to 5000 through 9999, will create the next
> partition at 10000, and everybody is happy.
>
> if an existing 4500 sector partition extends from 5600 to 10100, FDISK will
> "round down" this partition to 5000 through 9999, will create the next
> partition at 10000, and everybody is unhappy (sooner or later).

I do not understand... Why should FDISK "round down" the
start or end of the partition at all? It always has to
round AWAY from the actual start and end of existing
partitions. So in your example, if new partitions are
to have boundaries which are multiples of 1000 sectors,
the previous partition has to end at or before 5000 in
both examples and the next partition has to start at
10000 or later in the first and 11000 or later in the
second example. Rounding to NEAREST cylinder boundaries
seems to be always a bad idea?

Or are you saying the rounding just fails to know whether
it has to be up or rather down at the relevant moment, so
the author decided to simply round to nearest all times?

Regarding your next post: You say it would be hard to mark
clusters in non-FAT filesystems as blocked. My assumption
was that the FDISK bug only makes the END of FAT partitions
overlap later partitions. I was not expecting the bug to
also make the START of FAT partitions overlap non-FAT ones,
but indeed a FAT-based workaround cannot help you there.

I agree that it is a good thing if the KERNEL detects any
overlaps. Which makes me wonder whether it would be easy
to automatically block access to trailing overlapping FAT
clusters? Of course that still will not help you when the
partitions are also accessed by OTHER operating systems, so
a tool to mark overlapping clusters bad still sounds good.

So yes, I do like the suggestion to make the kernel check,
at least as a part of the solution.

---
FreeDOS / DOSEMU2 / ...

tom

Homepage

Germany (West),
11.01.2021, 23:13

@ mceric
 

Current FreeDOS fdisk utility

> > I think I understand the problem now, and it's not easy to fix.
> >
> > for ease of arithmetic, assume a cylinder size of 1000 sectors.
> >
> > if an existing 4500 sector partition extends from 5200 to 9700, FDISK
> will
> > "round down" this partition to 5000 through 9999, will create the next
> > partition at 10000, and everybody is happy.
> >
> > if an existing 4500 sector partition extends from 5600 to 10100, FDISK
> will
> > "round down" this partition to 5000 through 9999, will create the next
> > partition at 10000, and everybody is unhappy (sooner or later).
>
> I do not understand...
exactly. You do not understand.
It could help to read the relevant source code; search for Read_Partitiontables().


> Why should FDISK "round down" the
> start or end of the partition at all? It always has to
> round AWAY from the actual start and end of existing
> partitions. So in your example, if new partitions are
> to have boundaries which are multiples of 1000 sectors,
> the previous partition has to end at or before 5000 in
> both examples and the next partition has to start at
> 10000 or later in the first and 11000 or later in the
> second example. Rounding to NEAREST cylinder boundaries
> seems to be always a bad idea?
it's not 'rounding to NEAREST'. it's round DOWN for partition start,
round UP for (partition end + partition size). basically, FDISK thinks that partitions start at head=0, sector = 1, and end at head = 255, sector 63.


> Or are you saying the rounding just fails to know whether
> it has to be up or rather down at the relevant moment, so
> the author decided to simply round to nearest all times?
no.

> Regarding your next post: You say it would be hard to mark
> clusters in non-FAT filesystems as blocked. My assumption
> was that the FDISK bug only makes the END of FAT partitions
> overlap later partitions.
this bug has absolutely nothing to do with partition types.

> I agree that it is a good thing if the KERNEL detects any
> overlaps. Which makes me wonder whether it would be easy
> to automatically block access to trailing overlapping FAT
> clusters?
I really doubt other OS will implement code not to overwrite
partitions created by some buggy FDISK.

> Of course that still will not help you when the
> partitions are also accessed by OTHER operating systems, so
> a tool to mark overlapping clusters bad still sounds good.
Sure. And of course, you are not in charge to create such a tool :-(

mceric

Germany,
12.01.2021, 02:51

@ tom
 

Current FreeDOS fdisk utility

> exactly. You do not understand.

Indeed. So if it rounds the start of existing partitions
down and the end of existing partitions up, it sounds as
if it would do the right thing, but obviously it does not.

> It could help to read the relevant source code; search for
> Read_Partitiontables().

That would be in PDISKIO.C in version 132 (!) lines 781-1241,
first 919-967 depending on whether LBA is supported AND used:
In the LBA case, Extract_Cylinder_From_LBA_Value is used and
the code just ASSUMES that start is head 0, sect 1, end is
head max, sect max instead of CONVERTING from LBA values, as
a rather crude method for rounding DOWN or UP.

Also 1016-1092 for extended partitions and the logical chain
inside those, again with that fixed down and up rounding trick,
but due to the RELATIVE nature of chained logical partitions,
this seems more problematic than for primary partitions? Then,
a THIRD very similar copy of the same code from 1100-1166 and
again the same rounding style and AGAIN RELATIVE chaining.

(also, there is a silly typo: "easilly")

Note that Extract_Cylinder_From_LBA_Value seems to use long
instead of unsigned long for the LBA value?? The formula:

( ( (lba_value-(sector-1)) / total_sectors ) - head ) / (total_heads+1)

So if my intuition is right, one would want the Extract_...
code to use UNSIGNED LONG lba_value and would want to make
the processing of LOGICAL partitions use EXACT LBA values
for "walking the chain" and only do the rounding down or up
to the appropriate cylinder boundary AFTER that. As opposed
to first rounding (floor-ing/ceil-ing), then adding relative
offsets, then rounding (...) again. Is that the origin of
the bug that I had failed to understand in your description?



Interestingly, I not only have fdisk 1.2.0, 1.2.1 and 1.3.1
but also fdisk132.zip here (2009-06-08) but we only talk
about 1.2.1 and 1.3.1 in this thread?

> > ... My assumption
> > was that the FDISK bug only makes the END of FAT partitions
> > overlap later partitions.

I had written "FAT" there but mean "partitions created
using this version of FDISK" in that context.

> I really doubt other OS will implement code not to overwrite
> partitions created by some buggy FDISK.

Just wondered whether FreeDOS itself should do that, because
just refusing to use overlapping partitions at all might be
a bit harsh if too many users have them. So if the kernel can
automatically block itself from writin to overlapping zones...

About the versions:


Version 1.3.2   The CHECKEXTRA option has been defaulted to "false".
6/08/2009     
                The carry flag is no longer checked when checking for LBA
                as there have been some problems reported with some BIOS's
                and the carry flag checking.  In addition, the carry flag
                checking is redundant.

                A bug has been fixed that displayed an error message
                after the partition table(s) had been successfully written.

                Additional debugging code has been added for drive scanning.


But also:


Future changes planned for Version 1.3.2:
-----------------------------------------------------------------------------
TO-DO           Change the int 0x13 extension determination code.

                Add the partition id bytes.


And:


Version History:
-----------------------------------------------------------------------------
Version 1.3.1   The MBR is no longer automatically written if the expected               
11/04/2008      MBR is not found.  The MBR is now only written by using
                the command line switches.

                Various warnings have been cleaned up in order to fix the
                command-line compile.  One fix to the makefile remains.

                Error handling has been added in order to accomodate hard
                disk and/or controller errors.

Version 1.3.0   Bug fixes provided by H. Peter Anvin in order to fix a
7/17/2003       problem with the interrupt 0x13 extensions detection code.

Version 1.2.1   Some clean-ups of help screens.
04/06/2003
                Fixed a bug that prevented all FAT32 boot sector information
                from being erased when a new partition is created that starts
                at the exact same location as an old FAT32 partition.

Version 1.2.0   Improved the algorithms that calculate the partition size by
03/04/2003      percentage, when utilizing the command-line.

                Improved the command-line help screens.

                Fixed the bug that prevented the deletion of non-dos
                partition types.

---
FreeDOS / DOSEMU2 / ...

mceric

Germany,
12.03.2021, 16:13

@ tom
 

Current FreeDOS fdisk utility

New observation from Fritz: According to the FreeDOS kernel, FAT16 partitions made with the current FDISK have an exactly 1 cylinder "real versus calculated" (CHS, LBA, size...) mismatch which lets them end at the end of the first cylinder of the next partition depending on how you look at the data? The kernel does make a safe choice here, so troubles are limited to boot warnings. Fritz is busy double-checking, but to me it sounds like a classic off-by-one.

---
FreeDOS / DOSEMU2 / ...

tom

Homepage

Germany (West),
14.03.2021, 21:14

@ mceric
 

Current FreeDOS fdisk utility

> New observation from Fritz: According to the FreeDOS kernel,

what does 'according to the freedos kernel' mean?

> FAT16
> partitions made with the current FDISK have an exactly 1 cylinder "real
> versus calculated" (CHS, LBA, size...) mismatch which lets them end at the
> end of the first cylinder of the next partition depending on how you look
> at the data? The kernel does make a safe choice here, so troubles are
> limited to boot warnings. Fritz is busy double-checking, but to me it
> sounds like a classic off-by-one.

mind to post some data? like dumps, screenshots?
or even ways how to recreate this (fdsik has a command line interface)?

off-by-one's are difficult to debug by posting someone else's email complains.

tom

Homepage

Germany (West),
15.01.2021, 22:37

@ tom
 

Current FreeDOS fdisk utility

> I think I understand the problem now, and it's not easy to fix.
>
> for ease of arithmetic, assume a cylinder size of 1000 sectors.
>
> if an existing 4500 sector partition extends from 5200 to 9700, FDISK will
> "round down" this partition to 5000 through 9999, will create the next
> partition at 10000, and everybody is happy.
>
> if an existing 4500 sector partition extends from 5600 to 10100, FDISK will
> "round down" this partition to 5000 through 9999, will create the next
> partition at 10000, and everybody is unhappy (sooner or later).

unfortunately, I think my explanation was wrong, at least as far as Read_Partiton_Tables() is concerned. IMO this should work as expected.

the bug must be somewhere else.

unfortunately, the package as delivered doesn't compile as catgets.* is missing.

Japheth

Homepage

Germany (South),
16.01.2021, 18:56

@ tom
 

Current FreeDOS fdisk utility

> unfortunately, the package as delivered doesn't compile as catgets.* is
> missing.

But I see a cats396s\include\catgets.h and cats396s\lib\catgets.c.

In the meantime I found another 2 bugs:

- on a computer with an USB card reader, if I try to start fdisk, the program terminates with message "divide error". The USB card reader adds 4 drives to the BIOS, which - as long as there's no "card" inserted" - are reported having CYL/HEAD/SECT=0/0/0 and sector size = 0.

- on another machine with a GPT-partitioned disk ( having a "protective" MBR), fdisk thinks that 100% of the disk are free and happily creates a primary partition. During the creation process fdisk writes a few sectors filled with 0xf6 to the partition start - might do some damage to an installed windows/linux. :-D

---
MS-DOS forever!

tom

Homepage

Germany (West),
17.01.2021, 14:58

@ tom
 

Current FreeDOS fdisk utility

> > I think I understand the problem now, and it's not easy to fix.
> >
> > for ease of arithmetic, assume a cylinder size of 1000 sectors.
> >
> > if an existing 4500 sector partition extends from 5200 to 9700, FDISK
> will
> > "round down" this partition to 5000 through 9999, will create the next
> > partition at 10000, and everybody is happy.
> >
> > if an existing 4500 sector partition extends from 5600 to 10100, FDISK
> will
> > "round down" this partition to 5000 through 9999, will create the next
> > partition at 10000, and everybody is unhappy (sooner or later).
>
> unfortunately, I think my explanation was wrong, at least as far as
> Read_Partiton_Tables() is concerned. IMO this should work as expected.
>
> the bug must be somewhere else.
>
> unfortunately, the package as delivered doesn't compile as catgets.* is
> missing.

I found and fixed it in FDISK 1.22

like in a difficult Sudoku after the expert pointed it out to you.
once you see it, it's easy to see.

PDISKIO.C, line 954-964 should be changed to

          pDrive->pri_part[index].end_head=pDrive->total_head;
          pDrive->pri_part[index].end_sect=pDrive->total_sect;
          pDrive->pri_part[index].end_cyl
           =Extract_Cylinder_From_LBA_Value(
           /* */
           (pDrive->pri_part[index].rel_sect
           +pDrive->pri_part[index].num_sect)
          0,                           // !!,pDrive->pri_part[index].end_head
           1,                           // !!,pDrive->pri_part[index].end_sect
       ,pDrive->total_head
           ,pDrive->total_sect);


and similarly 1071 through 1091.

I will see if I can fix Japheth's recent 2 bugs.

RayeR

Homepage

CZ,
17.01.2021, 21:24

@ tom
 

Current FreeDOS fdisk utility

Well, but why to fix version 1.22 (or you mean 1.2.1?) instead of latest 1.3.1?

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
18.01.2021, 10:19

@ RayeR
 

Current FreeDOS fdisk utility

> Well, but why to fix version 1.22 (or you mean 1.2.1?) instead of latest
> 1.3.1?

because 1.2.1 compiles for me, and the bug is the same.

RayeR

Homepage

CZ,
21.01.2021, 02:57

@ tom
 

Current FreeDOS fdisk utility

> because 1.2.1 compiles for me, and the bug is the same.

OK, I ended compile problem too (using BC++). It needed catgets.h that was in separate library package but then another error:

bcc -ml -g1 -w -wccc -wrch -O -Z  -c main.c
Borland C++ 4.52 Copyright (c) 1987, 1994 Borland International
main.c:
Error main.c 644: Expression syntax in function main
Error main.c 644: Too many error or warning messages in function main
*** 2 errors in Compile ***


line 644: Set_Active_Partition(int(arg[0].value-1));

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
23.01.2021, 19:14
(edited by tom, 23.01.2021, 21:22)

@ tom
 

Current FreeDOS fdisk utility

> > Well, but why to fix version 1.22 (or you mean 1.2.1?) instead of latest
> > 1.3.1?
>
> because 1.2.1 compiles for me, and the bug is the same.

I hope

http://www.drivesnapshot.de/freedos/fdisk132.zip

fixes all 4 bugs (abort without .INI file, creating overlapping partitions, dividing by zero, not detecting protective partition on GPT disk)

edited: uppercase/lowercase was wrong

RayeR

Homepage

CZ,
23.01.2021, 20:51

@ tom
 

Current FreeDOS fdisk utility

Thanks but link doesn't work for me. Is the filename case OK?

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
23.01.2021, 21:18

@ RayeR
 

Current FreeDOS fdisk utility

> Thanks but link doesn't work for me. Is the filename case OK?
you are right: www.drivesnapshot.de/freedos/fdisk132.zip
should work

RayeR

Homepage

CZ,
26.01.2021, 04:01

@ tom
 

Current FreeDOS fdisk utility

I didn't test partitioning yet but I found that FreeFdisk displays wrong volume label on my SSD while MS Fdisk from Win98 displays them OK. I checked with disk editor and both bootsector and rootdir entry contains valid label. This problem also occured in old ver. 1.3.1 so it was there a long time but I overlooked it. Also disk sizes are reported differently, maybe due to different MB definitions.

http://rayer.g6.cz/1tmp/fdiskfd.jpg

http://rayer.g6.cz/1tmp/fdiskms.jpg

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
26.01.2021, 18:46

@ RayeR
 

Current FreeDOS fdisk utility

> I didn't test partitioning yet but I found that FreeFdisk displays wrong
> volume label on my SSD while MS Fdisk from Win98 displays them OK. I
> checked with disk editor and both bootsector and rootdir entry contains
> valid label. This problem also occured in old ver. 1.3.1 so it was there a
> long time but I overlooked it.

label display works here. could you post a dump of your bootsector?


Also disk sizes are reported differently,
> maybe due to different MB definitions.
>
> http://rayer.g6.cz/1tmp/fdiskfd.jpg
>
> http://rayer.g6.cz/1tmp/fdiskms.jpg

where both display the exact MB definition;-)

Japheth

Homepage

Germany (South),
28.01.2021, 22:21

@ RayeR
 

Current FreeDOS fdisk utility

> I didn't test partitioning yet but I found that FreeFdisk displays wrong
> volume label on my SSD while MS Fdisk from Win98 displays them OK. I
> checked with disk editor and both bootsector and rootdir entry contains
> valid label. This problem also occured in old ver. 1.3.1 so it was there a
> long time but I overlooked it.

I can confirm the wrong disk labels. Also, it's no regression, happens with v1.2.1 as well.

Also, fdisk has problems displaying the correct drive letters.

On my machine with 2 HDs are the following partitions
HD 0:
1. linux ext
2. linux swap
3. dos primary fat32,lba
HD 1:
1. dos primary fat32,lba
2. linux ext

HD 0, p3 is C: and HD 1, p1 is D:. fdisk, however, displays HD 0, p3 as D: and HD 1, p1 as C:.

This also happens with fdisk v1.2.1.






- mixes C: and D: on my machine.

---
MS-DOS forever!

tom

Homepage

Germany (West),
28.01.2021, 22:35
(edited by tom, 28.01.2021, 23:46)

@ Japheth
 

Current FreeDOS fdisk utility

> > I didn't test partitioning yet but I found that FreeFdisk displays wrong
> > volume label on my SSD while MS Fdisk from Win98 displays them OK. I
> > checked with disk editor and both bootsector and rootdir entry contains
> > valid label. This problem also occured in old ver. 1.3.1 so it was there
> a
> > long time but I overlooked it.
>
> I can confirm the wrong disk labels. Also, it's no regression, happens with
> v1.2.1 as well.

it would be cool to have more information.

'wrong disk labels' is nothing that can be debugged.

screenshots and dump of boot sector would be a start.

in addition: FDISK bases its decision on where to find the volume label on the partition type, not the actual filesystem. could this be a problem for your system?

in addition: the relevant code is most likely PDISKIO.C, 652
      /* Check for and get the volume label on a FAT12/FAT16 partition. */
      if(IsRecognizedFatPartition(pDrive->pri_part[partnum].num_type))
        {
        if (pDrive->pri_part[partnum].num_type == 11 ||
            pDrive->pri_part[partnum].num_type == 12 )
                {
                label_offset = 71;
                }
        else
                {
                label_offset = 43;
                }
         ´ReadSector(...)

                if( sector_buffer[label_offset+10]>=32 &&
                        sector_buffer[label_offset+10]<=122 )
                  {
                  /* Get Volume Label */
                  memcpy(pDrive->pri_part[partnum].vol_label,
                        sector_buffer+label_offset,
                        11);
                  }



check yourself if that makes sense:-P

RayeR

Homepage

CZ,
29.01.2021, 00:58

@ tom
 

Current FreeDOS fdisk utility

I'm quite sure that my bootsector is OK along the standards, check here:
http://rayer.g6.cz/1tmp/fat32bs.bin
label offset is 47h. It seems to me like fdisk reads the label from different location, maybe even different sector? Could you compile a debug version that will print the LBA number and byte offset in sector what is really reading while display label info? Then we can check if the LBA/offset match the desired position.

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
30.01.2021, 17:09

@ RayeR
 

Current FreeDOS fdisk utility

> I'm quite sure that my bootsector is OK along the standards, check here:
> http://rayer.g6.cz/1tmp/fat32bs.bin
> label offset is 47h. It seems to me like fdisk reads the label from
> different location, maybe even different sector? Could you compile a debug
> version that will print the LBA number and byte offset in sector what is
> really reading while display label info? Then we can check if the
> LBA/offset match the desired position.

debugging doesn't work that way, at least not for me. I will not add additional print statement every other day.

if you create a virtual disk that experiences this problem and send it to me, I promise to fix this issue.

otherwise, somebody who experiences this issue has to fire up the editor and do some debugging.

rr

Homepage E-mail

Berlin, Germany,
31.01.2021, 12:07

@ tom
 

Current FreeDOS fdisk utility

> debugging doesn't work that way, at least not for me. I will not add
> additional print statement every other day.
>
> if you create a virtual disk that experiences this problem and send it to
> me, I promise to fix this issue.

Thanks for your efforts regarding this big issue. :-)

---
Forum admin

RayeR

Homepage

CZ,
01.02.2021, 12:51

@ tom
 

Current FreeDOS fdisk utility

I could add some debug prints myself if it would at least compile with BC, got some (probably not serious) warning


Borland C++ 4.52 Copyright (c) 1987, 1994 Borland International
kbdinput.c:
Warning kbdinput.c 194: Conversion may lose significant digits in function Input

Error kbdinput.c 194: Too many error or warning messages in function Input
*** 1 errors in Compile ***

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
01.02.2021, 13:53

@ RayeR
 

Current FreeDOS fdisk utility

> I could add some debug prints myself if it would at least compile with BC,
> got some (probably not serious) warning
>
>
> Borland C++ 4.52 Copyright (c) 1987, 1994 Borland International
> kbdinput.c:
> Warning kbdinput.c 194: Conversion may lose significant digits in function
> Input
>
> Error kbdinput.c 194: Too many error or warning messages in function Input
> *** 1 errors in Compile ***
>


line_buffer[0]=(char)(default_value+48);

tom

Homepage

Germany (West),
01.02.2021, 14:54
(edited by tom, 01.02.2021, 16:38)

@ tom
 

Current FreeDOS fdisk utility

> if you create a virtual disk that experiences this problem and send it to
> me, I promise to fix this issue.

good news for everybody:

I'm able to reproduce this. after partitioning the drive using windows (on a non-divisible by 63 start sector), I also have a drive labeled "ve partition".

will fix this.

RayeR

Homepage

CZ,
02.02.2021, 07:28

@ tom
 

Current FreeDOS fdisk utility

I had to fix some more typing and absolute paths in makefile and was able to add some debug prints. On my SSD fdisk reads labels from this locations:

[SSD]
C: LABEL READ FROM: disk=128, part=0, C=0, H=0, S=0
L: LABEL READ FROM: disk=128, part=1, C=277, H=0, S=0

Symantec PartitionInfo 8.0 says:

EGeo 0x0000 16383 16 63 250069680 0 512
Disk 0:  16539 Cylinders, 240 Heads, 63 Sectors/Track.

============================ Partition Tables ==============================

Partition          -----Begin----      ------End-----     Start     Num

Sector     # Boot   Cyl Head Sect  FS   Cyl Head Sect     Sect      Sects

---------- - ----  ---- ---- ----  --  ---- ---- ----  ---------- ----------

         0 0 80       0    0    1  06   276  239   63        2048    4192256

Error #116: Starting sector of partition is inconsistent.

  ulStartSect = 2048

  Begin C,H,S = 0

Error #110: Number of sectors in partition is inconsistent.

  ucSectors   = 4192256
  end - begin = 4188240

         0 1 00   [ 277    0    1] 0C [ 872  239   63]    4194304  163840000 [Large Drive Placeholders]

                    277   96   17     11113   91   11                         Actual Values

Error #105: Partition didn't begin on head boundary.

ucBeginHead expected to be 0 or 1, not 96.

Error #106: Partition didn't begin on head boundary.

  ucBeginSector expected to be 1, not 17.

Error #108: Partition didn't end on cylinder boundary.

  ucEndHead expected to be 239, not 91.

Error #108: Partition didn't end on cylinder boundary.

  ucEndSector expected to be 63, not 11.

         0 2 00   [ 873    0    1] 83 [ 153  239   63]  168034304   82034688 [Large Drive Placeholders]

                  11113   91   12     16538  229    5                         Actual Values

Info: Partition didn't begin on head boundary.

ucBeginHead expected to be 0 or 1, not 91.

Info: Partition didn't begin on head boundary.

  ucBeginSector expected to be 1, not 12.

Info: Partition didn't end on cylinder boundary.

  ucEndHead expected to be 239, not 229.

Info: Partition didn't end on cylinder boundary.

  ucEndSector expected to be 63, not 5.



LBA values are guaranted to be correct ones.

---
DOS gives me freedom to unlimited HW access.

Japheth

Homepage

Germany (South),
02.02.2021, 08:59

@ RayeR
 

Current FreeDOS fdisk utility

> [SSD]
> C: LABEL READ FROM: disk=128, part=0, C=0, H=0, S=0
> L: LABEL READ FROM: disk=128, part=1, C=277, H=0, S=0

Does it really (try to) read with C/H/S mechanism and sector==0? That's very unlikely. Perhaps you should show us the source with your debug displays.

I installed an int 13h "monitor", trying to find out what sectors are read by fdisk, and on the hdd installed on my machine it uses int 13h, ah=42h ( reading with LBA, as expected ).

---
MS-DOS forever!

RayeR

Homepage

CZ,
02.02.2021, 13:18
(edited by RayeR, 02.02.2021, 15:37)

@ Japheth
 

Current FreeDOS fdisk utility

I put printing in PDISKIO.C line 588 , func void Get_Partition_Information()

      /* Check for and get the volume label on a FAT12/FAT16 partition. */
      if(IsRecognizedFatPartition(pDrive->pri_part[partnum].num_type))
        {
        if (pDrive->pri_part[partnum].num_type == 11 ||
            pDrive->pri_part[partnum].num_type == 12 )
                {
                label_offset = 71;
                }
        else
                {
                label_offset = 43;
                }
printf("\nLABEL READ FROM: disk=%u, part=%u, C=%u, H=%u, S=%u", drivenum+128, partnum, pDrive->pri_part[partnum].start_cyl, pDrive->pri_part[partnum].start_head, pDrive->pri_part[partnum].start_sect);
                Read_Physical_Sectors((drivenum+128)
                 ,pDrive->pri_part[partnum].start_cyl
                 ,pDrive->pri_part[partnum].start_head
                 ,pDrive->pri_part[partnum].start_sect,1);




When I go to CHS 277, 0, 1 in Norton Disk Editor I got bad location - the same that Fdisk tries to load but there's no real boot sector. So it's probably inconsistent with LBA as Symantec PartitionInfo 8.0 suggest the partition should start at 277, 96, 17. I don't remember what tool I had used for partitioning the SSD, it's many years go. Maybe gparted as I wanted SSD to have sector block aligned instead of track aligned.
http://rayer.g6.cz/1tmp/part.jpg
So should I adjust CHS in partition table? I wonder that damn CHS didn't died many years ago, eg. SCSI drives never used it. Instead having partition entry with duplicate LBA and CHS values we could have one 64b LBA that will be enough for many years in future...

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
02.02.2021, 15:59

@ RayeR
 

Current FreeDOS fdisk utility

> When I go to CHS 277, 0, 1 in Norton Disk Editor I got bad location
> - the same that Fdisk tries to load but there's no real boot sector. So
> it's probably inconsistent with LBA as Symantec PartitionInfo 8.0 suggest
> the partition should start at 277, 96, 17.

this is because FDISK doesn't use the values as they come from the partition table, but insists that the start of a partition must be on head 0, sector 1, even when it doesn't.

a fix is almost done

RayeR

Homepage

CZ,
02.02.2021, 19:40

@ tom
 

Current FreeDOS fdisk utility

OK, by a fix you mean that Fdisk will be able to read bootsector from unaligned CHS partition start? In my case shoul I fix CHS in partition entry? As it's now it doesn't make much sense, it's aligned but point to wrong location. Are there any potential issues with other OSes/tools when I change it? I think most use LBA so don't care, currently I have no issuses.

---
DOS gives me freedom to unlimited HW access.

RayeR

Homepage

CZ,
03.02.2021, 04:05

@ RayeR
 

Current FreeDOS fdisk utility

I just tried the old original Fdisk from msdos 6.22 (c) 1993 and it displays at least correct label from 1st partition - I wonder how when it doesn't know LBA. partition sizes are wrong and printing is a bit messed up.
http://rayer.g6.cz/1tmp/part622.jpg
I also tried to change CHS entries to match LBA and as expected it changed anything for Free Fdisk (yes you said it doesn't take CHS from there directly).

---
DOS gives me freedom to unlimited HW access.

tom

Homepage

Germany (West),
09.02.2021, 17:35

@ tom
 

Current FreeDOS fdisk utility

> > When I go to CHS 277, 0, 1 in Norton Disk Editor I got bad
> location
> > - the same that Fdisk tries to load but there's no real boot sector. So
> > it's probably inconsistent with LBA as Symantec PartitionInfo 8.0
> suggest
> > the partition should start at 277, 96, 17.
>
> this is because FDISK doesn't use the values as they come from the
> partition table, but insists that the start of a partition must be on head
> 0, sector 1, even when it doesn't.
>
> a fix is almost done


www.drivesnapshot.de/freedos/fdisk133.zip

should list all volume labels.

Japheth

Homepage

Germany (South),
10.02.2021, 06:45

@ tom
 

Current FreeDOS fdisk utility

> www.drivesnapshot.de/freedos/fdisk133.zip
>
> should list all volume labels.

Yes, it works!

Btw., I have a notebook where I (long ago) added an (overlapping) FAT32 partition with old fdisk 1.2.1 to an existing Win7 NTFS partititon. Win7 never did display an error message, but it wasn't possible to access the FAT32 partition from within Win7, it was "ignored".

---
MS-DOS forever!

RayeR

Homepage

CZ,
11.02.2021, 19:03

@ Japheth
 

Current FreeDOS fdisk utility

> Btw., I have a notebook where I (long ago) added an (overlapping) FAT32
> partition with old fdisk 1.2.1 to an existing Win7 NTFS partititon. Win7
> never did display an error message, but it wasn't possible to access the
> FAT32 partition from within Win7, it was "ignored".

Interesting, would Windows 7 do some check? How it exactly looks in computer management/disk manager? Is there visible an unknown partition or nothing?

---
DOS gives me freedom to unlimited HW access.

RayeR

Homepage

CZ,
12.02.2021, 02:44

@ tom
 

Current FreeDOS fdisk utility

Thank's, it displays labels on all of my partitions OK now.

---
DOS gives me freedom to unlimited HW access.

Japheth

Homepage

Germany (South),
29.01.2021, 06:37
(edited by Japheth, 29.01.2021, 07:35)

@ tom
 

Current FreeDOS fdisk utility

> screenshots and dump of boot sector would be a start.

The infos displayed by fdisk don't come from the boot sector.
Here are the partition tables:

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size      MB
-------------------------------------------------------------------------------
00 83 Linux ext2fs            0/ 32/33 1023/254/63       2048  204800000 100000
00 82 Linux Swap           1023/254/63 1023/254/63  204802048   16777216   8192
00 0c Prim. DOS,FAT32,LBA  1023/254/63 1023/254/63  221579264   16777216   8192

BI Type                    Start-C/H/S   End-C/H/S     Sector     Size      MB
-------------------------------------------------------------------------------
80 0c Prim. DOS,FAT32,LBA     0/  0/ 1 1006/254/63       2048   65536000  32000
00 83 Linux ext2fs         1007/  0/ 1   63/254/63   65538048   67108864  32768


For disk 2, fdisk displays as disk label "ve partitio", and that's exactly the string at offset 0x47 (decimal 71) of sector 0 (the grub modified MBR, the full string there is "no active partition found").

So fdisk translates the Start-CHS (0/0/1) into a LBA and reads this sector. That's wrong for both FAT32 partitions on Disk 1 and 2.

---
MS-DOS forever!

Ringding

29.01.2021, 09:30

@ Japheth
 

Current FreeDOS fdisk utility

> Here are the partition tables:
>
> BI Type                    Start-C/H/S   End-C/H/S     Sector     Size     
> MB
> -------------------------------------------------------------------------------
> 80 0c Prim. DOS,FAT32,LBA     0/  0/ 1 1006/254/63       2048   65536000
> 32000
> 00 83 Linux ext2fs         1007/  0/ 1   63/254/63   65538048   67108864
> 32768
>

>
> So fdisk translates the Start-CHS (0/0/1) into a LBA and reads this sector.
> That's wrong for both FAT32 partitions on Disk 1 and 2.

On disk 2, C/H/S is actually wrong for the first partition, though, which is supposed to start at sector 2048.

Japheth

Homepage

Germany (South),
29.01.2021, 15:19

@ Ringding
 

Current FreeDOS fdisk utility

> On disk 2, C/H/S is actually wrong for the first partition, though, which
> is supposed to start at sector 2048.

That's true - although it doesn't matter.

However, my theory is apparently wrong - because I changed the cyl/head/sec of the fat32 partition on drive 2 with a disk editor to the "correct" value ... and the mysterious result is/was that fdisk still displays "ve partitio" as label ...:-(

---
MS-DOS forever!

Back to index page
Thread view  Board view
22049 Postings in 2034 Threads, 396 registered users, 81 users online (0 registered, 81 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum