Overall organization

Jin Hur·2021년 7월 1일
0

[Linux] File system

목록 보기
8/22

reference: https://pages.cs.wisc.edu/~remzi/OSTEP/, 시스템 프로그래밍, 운영체제 수업(최종무 교수님)

1. Disk

  • 파티션들로 구성
  • 각 파티션에 하나의 파일 시스템 생성

    그림1. disk와 각 파티션

2. Partition

  • 디스크 블록들로 구성
  • 유저 데이터는 디스크 블록에 저장(disk block: usally same size with the page, usally 4KB)

    그림2. disk blocks
    • 현재 파티션에는 64개의 디스크 블록이 있다 가정.

3. Layout of a file system


그림3. layout of a file system

(1). Superblock: 0 block

  • metedata for managing a file system(one per a file system)
  • information: how many data blocks, inodes, where they begin...
  • used during a mount function

(2). Bitmap: 1/2 blocks

  • metadata for managing free space(allocation structure)
  • Two bitmaps: one for data blocks and the other for inodes
  • free space
    • one bit per block(or inode), including whether it is free or used
    • Alternative approach: free-list, tree, …
    • Pre-allocation: allocate free disk blocks in a batch manner -> less overhead, contiguous allocation, …

(3). inode: 3~7 blocks

  • matadata for managing files(one per a file)
  • inode size = 256B
    => 16 inodes per a block
    => 5 blocks for inode
    => total 80 files can be created

(4). User data: 8~63 blocks (can be dynamically adjusted)

  • data written by users

4. inode

How to manage metadata for a file?

  • inode (index node)
    • (1) File information such as mode, uid, size, time, link count, blocks, …
    • (2) Locations of User data blocks => Multi-level index and imblanced tree
      • direct block pointers, single/double/triple indirect block pointers
      • benefit: fast for a short file and big size support for a large file

  • other approach: FAT(linked based), Extent-based, Log-badsed ..

    그림4. file information in inode and inode layout

0개의 댓글