1 / 20

File System Lab

File System Lab. ext2 file system layout. The layout of the system:. Super block: The superblock contains all the pertinent global information for the entire drive. Information such as: the total number of blocks on disk, the size of the blocks, the number of free blocks, and so forth.

mari
Download Presentation

File System Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File System Lab

  2. ext2 file system layout • The layout of the system:

  3. Super block: • The superblock contains all the pertinent global information for the entire drive. Information such as: the total number of blocks on disk, the size of the blocks, the number of free blocks, and so forth.

  4. GDT: group descriptor table • The blocks immediately after the superblock contain a list of group descriptors (essentially an array of group descriptors). This list contains a descriptor for each block group.

  5. Block bitmap and Inode bitmap: • ext2 keeps track of free space using bitmaps. • The blocks bitmap tracks free blocks (raw space), and the inode bitmap tracks free inodes. • These bitmaps are fixed size and are exactly 1 block large. • With a block size of 1024, the block bitmap contains 1024 8 = 8192 bits, which means that the block group can have no more than 8K blocks.

  6. Inode table: • An inode is 128byte • file attributes and data blocking information

  7. Data block: • Regular files: Data • Directory: name of files and subdirectory • Symbolic link: name in either inode or a data block

  8. $ dd if=/dev/zero of=fs count=256 bs=4K • if input file • of output file • mke2fs fs • To make a file system out of the fs file • Block size; inodes • sudo mount –o loop fs /mnt

  9. dumpe2fs fs • Inode count 128 • Block count 1024 • Free blocks: 986 • Free inodes:117 • First inode:11 • Inode size: 128 • Primary superblock: 1 • Group descriptor: 2 • Block bitmap:6 • Inode bitmap: 7 • Inode table: 8-23

  10. sudo mount –o loop fs /mnt • od -tx1 –Ad fs

  11. Super block • od -tx1 –Ad fs –N1024

  12. Group descriptor • od –tx1 –Ad fs –N1024 –j2048 • Group 0: (Blocks 1-1023) • Primary superblock at 1, Group descriptors at 2-2 • Reserved GDT blocks at 3-5 • Block bitmap at 6 (+5), Inode bitmap at 7 (+6) • Inode table at 8-23 (+7) • 986 free blocks, 117 free inodes, 2 directories • Free blocks: 38-1023 • Free inodes: 12-128

  13. Block bitmap od -tx1 -Ad fs -N1024 -j6144 0006144 ff ff ff ff 1f 00 00 00 00 00 00 00 00 00 00 00 0006160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0006256 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 0006272 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff * 0007168

  14. Inode bitmap od -tx1 -Ad fs -N1024 -j7168 0007168 ff 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0007184 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff * 0008192

  15. Inode table • od -tx1 -Ad fs –N2048 –j8192 0008192 00 00 00 00 00 00 00 00 46 3a 2b 50 46 3a 2b 50 0008208 46 3a 2b 50 00 00 00 00 00 00 00 00 00 00 00 00 0008224 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0008320 ed 41 e8 03 00 04 00 00 c9 4b 2b 50 46 3a 2b 50 0008336 46 3a 2b 50 00 00 00 00 e8 03 03 00 02 00 00 00 0008352 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 0008368 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0008960 80 81 00 00 00 30 04 04 46 3a 2b 50 46 3a 2b 50 0008976 46 3a 2b 50 00 00 00 00 00 00 01 00 08 00 00 00 0008992 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0009040 00 00 00 00 00 00 00 00 00 00 00 00 25 00 00 00 0009056 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0009472 ed 49 00 00 00 30 00 00 46 3a 2b 50 2a 4c 2b 50 0009488 46 3a 2b 50 00 00 00 00 00 00 02 00 18 00 00 00 0009504 00 00 00 00 00 00 00 00 19 00 00 00 1a 00 00 00 0009520 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00

  16. Data block Block 24: od -tx1 -Ad fs -N1024 -j24576 0024576 02 00 00 00 0c 00 01 02 2e 00 00 00 02 00 00 00 0024592 0c 00 02 02 2e 2e 00 00 0b 00 00 00 e8 03 0a 02 0024608 6c 6f 73 74 2b 66 6f 75 6e 64 00 00 00 00 00 00 0024624 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  17. Data block • Block 24: • After mkdir a in /mnt 0024576 02 00 00 00 0c 00 01 02 2e 00 00 00 02 00 00 00 0024592 0c 00 02 02 2e 2e 00 00 0b 00 00 00 14 00 0a 02 0024608 6c 6f 73 74 2b 66 6f 75 6e 64 00 00 0c 00 00 00 0024624 d4 03 01 02 61 00 00 00 00 00 00 00 00 00 00 00 0024640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  18. Data block • Block 24 • After touch a.txt 0024576 02 00 00 00 0c 00 01 02 2e 00 00 00 02 00 00 00 0024592 0c 00 02 02 2e 2e 00 00 0b 00 00 00 14 00 0a 02 0024608 6c 6f 73 74 2b 66 6f 75 6e 64 00 00 0c 00 00 00 0024624 0c 00 01 02 61 00 00 00 0d 00 00 00 c8 03 05 01 0024640 61 2e 74 78 74 00 00 00 00 00 00 00 00 00 00 00 0024656 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0025600

  19. Inode table • od -tx1 -Ad fs -N2048 -j8192 0009472 ed 49 00 00 00 30 00 00 d3 51 2b 50 e5 51 2b 50 0009488 e5 51 2b 50 00 00 00 00 00 00 02 00 18 00 00 00 0009504 00 00 00 00 00 00 00 00 19 00 00 00 1a 00 00 00 0009520 1b 00 00 00 1c 00 00 00 1d 00 00 00 1e 00 00 00 * 0009600 fd 41 e8 03 00 04 00 00 e9 51 2b 50 e9 51 2b 50 0009616 e9 51 2b 50 00 00 00 00 e8 03 02 00 02 00 00 00 0009632 00 00 00 00 00 00 00 00 26 00 00 00 00 00 00 00 0009648 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0009696 00 00 00 00 ef 0c 2d 61 00 00 00 00 00 00 00 00 0009712 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0009728 b4 81 e8 03 00 00 00 00 53 53 2b 50 53 53 2b 50 0009744 53 53 2b 50 00 00 00 00 e8 03 01 00 00 00 00 00 0009760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

More Related