7,652 views

A file system with a one-level directory structure is implemented on a disk with disk block size of $4K$ bytes. The disk is used as follows:
$$\begin{array}{|l|}\hline \text{Disk-block 0} & & \text{File Allocation Table, consisting of one 8-bit } \\ \text{} && \text{entry per data block, representing the data } \\ \text{} && \text{block address of the next data block in the file} \\ \hline \text{Disk-block 1} & & \text{Directory, with one 32 bit entry per file:} \\\hline \text{Disk-block 2} & & \text{Data-block 1;} \\ \hline \text{Disk-block 3} & & \text{Data-block 2; etc.} \\ \hline\end{array}$$

1. What is the maximum possible number of files?
2. What is the maximum possible file size in blocks

FAT size = Number of blocks in HDD * size of each entry. Can't we consider here that FAT takes entire Disk 0 block then 4kB= number of blocks in HDD * 8 bits thus giving the total blocks in HDD.
Have the same doubt. Please do comment if u have cleared it

@Shaik Masthan Your view on this :- FAT size = Number of blocks in HDD * size of each entry. Can't we consider here that FAT takes entire Disk 0 block then 4kB= number of blocks in HDD * 8 bits thus giving the total blocks in HDD.

1. Maximum possible number of files:
As per question, $32$ bits (or $4$ Bytes) are required per file. And there is only one block to store this, ie the Disk block $1$, which is of size $4$KB.  So number of files possible is  $4$ KB$/4$ Bytes$=1$ K files possible.
2. Max file size:
As per question the Disk Block Address (FAT entry gives DBA) is of $8$ bits. So, ideally the max file size should be $2^8=256$ Block size.. But question makes it clear that two blocks, DB0 and DB1, stores control information. So. effectively we have $256-2 =254$ blocks with us and the max file size shoud be $=254 \times$ size of one block $= 254 \times 4$ KB $= 1016$ KB.
by

This is what I thought as well. Since there is an 8-bit entry per block address and since the data block is 4K bytes in size, total number of addresses can be 4096 and hence 4094 data blocks for that file. I don't understand why the remaining answers limit the number of addresses to only 256.

@Arjun sir, could you kindly clarify this? Thanks in advance.

@CHIRAG CHAWLA

Initially, I too thought the same. But, FAT only stores the disk block address which is of 8 bit according to the question. So, FAT will contain 256 entries and rest of the disk block 0 will be empty.

edited
@Abyssal FAT contains all the block addresses of a file, 8 bits represent the address of a data block and you are saying that there are 4096 blocks so, for this FAT entry should be of 12 bits.

You can’t represent 4096 blocks with 8 bits.

so this surely means that some of the disk block 0 is not filled or we can also say that disk block 0 contains only 256 entries.

Here 2 blocks are used for the directory.

First blocks store the FAT and second block Store the Directory.Each entry second block can contain file name, starting block and metadata.

so No of files=4KB/4B = 1024 maximum files are possible.

As shown in diagram each entry in FAT stores the next block address of the same file. so total 256 blocks per file are possible.

The FTA table is created for all files at one place. If disk having only 256 blocks then max file size =256-2=254. But here it can allocate 256 blocks.

so maximum file size should be 256 blocks.

by

### 1 comment

Now max possible data blocks is 256.

max possible files should also be 256 and not 1K.

Am I right ??

@papesh @Arjun