• Please review our updated Terms and Rules here

DOS directory limits?

Mike Chambers

Veteran Member
Joined
Sep 2, 2006
Messages
2,621
just wondering, under DOS with a FAT16 partition... what is the maximum of files allowed inside of any one directory? what about the partition as a whole?
 
The root directory is a fixed size, but subdirectories can be any size you like. So in theory, to get the maximum number of files on the drive, you could create a subdirectory and fill it with 0-byte files; and then fill the root directory with zero-byte files as well.

You would therefore end up with all of the drive containing directory entries, of which there would be:
(Number of sectors on drive - number of boot and FAT sectors) * (512/32)
and then subtract 3 for the subdirectory itself and its "." and ".." entries.

If you actually want the files to be longer than 0 bytes, you could have as many files as there are clusters on the drive, minus 1 for the subdirectory that holds them. A FAT16 filesystem can have a maximum of, what, 65520 clusters?
 
thanks for the info... was curious because i am developing a SMTP/POP3 server for DOS, and was considering a couple different ways to store users' message data.

first way was give each user their own subfolder under a mailboxes directory, and each individual message could be stored as it's own seperate file with a unique ID number... i was thinking 16-bit would be enough for that, giving up to 65536 single messages for each user (like that'll ever get filled up) - there would be an index file for each user also, which has the mail headers associated with message and it'd ID number.

second way was to just have one big file for each user's mailbox with an index file (or a built-in header) that has header data and offsets/lengths of each message in the file.

i am leaning towards the first option, because it'd be a lot quicker on say an XT during message delete operations... simply deleting a file and freeing up it's index number would be WAY faster then seeking into a combined mailbox file, while copying it's contents to a temporary file, then skip over the newly deleted message, and moving the rest of the data back down to an earlier offset, deleting the file, and renaming the temporary file to the regular mailbox filename.

^how's that for a run-on sentence? lol.

does anybody with experience with this sort of thing have any reccomendations?
 
Define what you mean by a SMTP/POP3 server. What are your client systems going to look like? Do you expect to be able to relay mail to other mail servers on the net?

If you use a lot of small files (one for each message) then you are going to waste a lot of disk space. Files take up multiples of clusters, and unused space at the end of a file is dead space. You are also going to fragment the drive very quickly.

The better way to do it is to put the mail in one big file. But when you delete a message, you don't compact the file - you just leave the hole in the file and fill it in with the next new message. The XT would take too long to compact the file every time you deleted a message.

I don't think this is a great app for the XT. It can't handle the size of modern email, it's painfully slow on disk access, and the CPU can't handle too much work. For an occasional text message it would be fine, but not much more.

Think of it like this - if you had trouble with an IRC server staying up reliably, do you think you can do better with an email server?
 
Define what you mean by a SMTP/POP3 server. What are your client systems going to look like? Do you expect to be able to relay mail to other mail servers on the net?

If you use a lot of small files (one for each message) then you are going to waste a lot of disk space. Files take up multiples of clusters, and unused space at the end of a file is dead space. You are also going to fragment the drive very quickly.

The better way to do it is to put the mail in one big file. But when you delete a message, you don't compact the file - you just leave the hole in the file and fill it in with the next new message. The XT would take too long to compact the file every time you deleted a message.

I don't think this is a great app for the XT. It can't handle the size of modern email, it's painfully slow on disk access, and the CPU can't handle too much work. For an occasional text message it would be fine, but not much more.

Think of it like this - if you had trouble with an IRC server staying up reliably, do you think you can do better with an email server?

well, i don't plan to necessarily use it on an XT... i just was thinking about speed so that if somebody REALLY wanted too, they could use my program on one. i agree about mail sizes. it'd be good on an XT for regular ol' text mails, and even for some pictures maybe...

if i used it, it'd probably be on like a 386 or 486... i've been looking for a use for those anyway. :p

i was going to have relaying to another SMTP server an option, as well as delivering all the mail to people from it's own built in mail engine.


oh btw on another topic, i've started playing around with TC 3.0! i installed it in dosbox just to toy with it and experiment. :)
 
I have to agree with MBB, but if you're really determined I'd use either 1 file for everything or at least 1 file per user with separate index/pointer files. I wouldn't even make and reuse holes; just mark deletions as deleted and append additions, and periodically copy undeleted to new files and defrag.

m
 
thanks for the info... was curious because i am developing a SMTP/POP3 server for DOS, and was considering a couple different ways to store users' message data.

first way was give each user their own subfolder under a mailboxes directory, and each individual message could be stored as it's own seperate file with a unique ID number... i was thinking 16-bit would be enough for that, giving up to 65536 single messages for each user (like that'll ever get filled up) - there would be an index file for each user also, which has the mail headers associated with message and it'd ID number.

No no no no no. Just because you *can* do something doesn't mean you *should*.

I don't see the point in developing a POP3/SMTP server for DOS: If the machine is slow, it's only good for client ops; if it's fast, it can run something more appropriate for this like FreeBSD or another older lightweight OS.

IF you are still going to do this, maintain a single file, with a reasonable block size (4K comes to mind), and just make changes to that file. One (large) file to open, seek, read from, and write/append to.
 
I have to agree with MBB, but if you're really determined I'd use either 1 file for everything or at least 1 file per user with separate index/pointer files. I wouldn't even make and reuse holes; just mark deletions as deleted and append additions, and periodically copy undeleted to new files and defrag.

m

Seconded!

But, again, if you've got a 386 you can run FreeBSD 2.7 or something much more appropriate for this (and you don't even have to reinvent the wheel).

If you have that much free time, work on that telnet server you tossed around. THAT would be one hell of a cool trick ("Hey, telnet into my DOS machine!")
 
Seconded!

But, again, if you've got a 386 you can run FreeBSD 2.7 or something much more appropriate for this (and you don't even have to reinvent the wheel).

If you have that much free time, work on that telnet server you tossed around. THAT would be one hell of a cool trick ("Hey, telnet into my DOS machine!")

hah

person 1: "hey do you want a shell on my system that you can use?"

person 2: "yeah, sure! what version of linux do you run?"

person 1: "DOS."

person 2: "don't touch me."
 
the main reason i want to make a mail server is because there's a certain forum that i love to troll because every there is a jerkface, and pretty soon after i make accounts they figure it out and ban me again... can't use the same e-mail to register twice, soooooo.... it'll be handy making new accounts on a whim :D

don't worry, it's not this forum.

but yeah, i mean obviously boeing isn't about to trash their network and replace their mail system with an 8088 but even an XT or 286 mail server would be adequete for a small-scale setup... light traffic, and not a billion people logging in every every 2 minutes.
 
the main reason i want to make a mail server is because there's a certain forum that i love to troll because every there is a jerkface, and pretty soon after i make accounts they figure it out and ban me again... can't use the same e-mail to register twice, soooooo.... it'll be handy making new accounts on a whim :D

don't worry, it's not this forum.

but yeah, i mean obviously boeing isn't about to trash their network and replace their mail system with an 8088 but even an XT or 286 mail server would be adequete for a small-scale setup... light traffic, and not a billion people logging in every every 2 minutes.

Of course putting it up with an MX record will start getting snoops very quickly. Even with a moderately sized domain we see a low average of at least 15 (sic) "messages" per second, under high load above 50 per second. Guess how much of that is spam?

So much that we run a spam filtering server (by far, the server doing the most work on our network) front end separate from our mail servers...
 
Back
Top