SOA
feb2011
inode
Let be a Unix-like file system, based on i-nodes, mounted on a device with a storage capacity of 32 MiB and a block size of 512 bytes. These blocks hold the following information:
The i-nodes will be eight bytes, each, and will store the following information:
DIR
), link (LNK
), regular file (REG
),named pipe (FIFO
), block file (BLQ
), character file (CAR
).This file system is organized in directories, which occupy a block of data, and maintain the following structure for each of their entries:
Taking into account the characteristics of the file system described, answer the following questions:
a) How many data blocks are available to store information?
The number of data blocks available for storing information will be given by the number of blocks in the device, minus the boot block and the blocks held by the file system.
b) What is the maximum number of i-nodes?
From the text, the i-node list occupies the blocks from 2 to 9, that is 8 blocks. Each i-node is 8 bytes, so the number of i-nodes will be:
c) What is the maximum file size that could be stored?
That will be given by the minimum of:
The i-node has two pointers, one can address a single block, the second can address as many blocks as pointers can hold. Given that the size of the pointer in the i-node is 2 bytes, a 512 bytes block can hold 256 pointers to 256 block. Thus, the max number of blocks per file will be 256 + 1 + 1 = 258 blocks, which is less than the available space in the device 65.526 blocks, so the limit will be
You have a pendrive connected to the USB port, whose content is only the file quijote.txt
of size 4 KiB. Assuming that the file system contains only the root directory and the directory /media
, indicate what would be the final state of the storage device, the content of its i-node list and the data blocks, after performing the following operations:
/dev
directory and the block mode device /dev/sda
have not been represented for simplicity. Just assume that they somehow magically exist for mount.i-node |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|
File type | DIR | DIR | DIR | REG | DIR | FIF | DIR | REG | LNK |
#hard links | 4 | 3 | 3 | 1 | 2 | 1 | 2 | 1 | 1 |
Size (in blocks) | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 9 | 1 |
Device | 96 | 96 | 96 | 96 | 96 | 96 | 96 | 96 | 96 |
PtrDir | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 26 |
PtrInd | nul | nul | nul | nul | nul | nul | nul | 18 | nul |