Question

I recently have this question for my homework and I have trouble figuring it out. I tried searching online, but I can't seem to find any answers.

" Some file systems use two block sizes for disk storage allocation, for example, 4- Kbyte and 512-byte blocks. Thus, a 6 Kbytes file can be allocated with a single 4- Kbyte block and four 512-byte blocks. Discuss the advantage of this scheme compared to the file systems that use one block size for disk storage allocation. "

So are more blocks better?

Any help? thanks in advance.

Était-ce utile?

La solution

You can't have a big amount of different block sizes, that would be hell to implement and manage. I also think that some hardware limitations restrain what sizes you can use.

Now the thing is, unless the amount of data you wish to store fits exactly in all the blocks you are using, then some space is going to be wasted in the last block.

For example, if your block is one gygabyte long (hypothetically speaking), and you want to store a 1 or 2 bytes long file, you've just wasted nearly a gigabyte of disk space. All information is stored as blocks. You can't store half a block.

Long blocks make for better performance, though, since the disk may spend more time fetching information from a block before proceeding to the next one. Also it's less blocks to track and manage.

Linux is a fun operating system to play with because it can work with so many different file systems (as far as I remember you only get some variations of FAT and NTFS with Windows). You could read more about file system on this link:

Linux System Administrators Guide: Chapter 5. Using Disks and Other Storage Media

See section 5.10.5 for more info on advantages and disadvantages of small and big block sizes.

So back to your question: having different block sizes like that allows you to optimize storage. You can minimize wasted space by switching to smaller blocks by the end of the file, while having as few blocks as possible to reduce I/O times.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top