리눅스데브코스 [11주차 - 4]<리눅스 파일시스템 및 저장장치 기술(2)>

심우열·2023년 7월 2일
0

1. 파일시스템 기본구조

1. Metadata

  • 파일과, 파일 시스템을 관리하기 위해 사용되는 정보들

1. Superblock

  • 파일 시스템을 관리하기 위한 메타데이터
  • 총 크기, 블록 크기, inode 위치, root 디렉토리 등등
  • Superblock은 하나의 파일시스템에 대해 한개 생성

2. inode

  • 파일을 관리하기 위한 메타데이터
  • 파일들의 특성과 디스크 블록 위치를 저장
  • inode는 파일마다 하나씩 생성

3. Bitmap

  • 어떠한 데이터 블록이 또는 inode가 사용중인지 아닌지에 대한 정보를 담고 있는 자료구조

4. Others

  • group descriptor, journal, FAT, segment, ...

2. 파일의 메타데이터를 관리하는 방법

1. inode(index node)

  • 파일의 정보들(mode, uid, size, time, link count, blocks, ...)
  • stat() 을 통해 접근할 수 있음

inode 가 담고 있는 정보들

  • 유저 데이터 블록의 위치를 담고 있음
  • direct block pointer(10개 or 12개 or 15개), Single/ Double/ Triple (레벨)의 indirect block pointer
  • Multi-level index와 imbalanced tree

direct block pointer와 indirect block pointer

2. inode가 지원할 수 있는 최대 파일 크기

1. Direct block pointer

  • 12개

따라서 12 * 4 = 48KB

2. Indirect block pointer

    • Indirect block pointer 가 가르키는 index 블록의 크기는 4kb
  • 블록 포인터의 크기는 4byte
  • 즉 하나의 index 블록이 가르킬수 있는 블록은 1024개

Single level Indirect block pointer

  • 1 1024 4kb = 4MB

Double level Indirect block pointer

  • 1 1024 1024 * 4kb = 4GB

Triple levle Indirect block pointer

  • 1 1024 1024 1024 4kb = 4TB

총 4TB + 4GB + 4MB + 48KB 의 크기를 inode가 지원할 수 있다.

2. 디렉토리

1. 디렉토리란?

1. 유저 관점

  • 관련된 파일들의 집합

2. 시스템 관점

  • <파일 이름, inode 번호> 쌍의 리스트

3. UFS(Unix File System)

1. 특징

  • 모든 것은 파일로 관리된다.
  • inode와 direct pointer, indirect pointer를 사용하여, 작은 크기의 파일부터 대용량의 파일까지 탐색한다.
  • 디렉토리는 파일 이름과 그것의 inode 번호를 가지고 있다.

4. 파일 시스템 성능 개선

1. FFS

5. FS 관련 명령어

1. Storage identification and partitioning

1 .lsblk

  • list information about all available or the specified block divices

2. fdisk

  • partitioning management

3. MKFS

  • make file system
  • 지정한 디스크를 지정한 파일시스템으로 초기화 함

4. mount

  • Make a file system visible to user
  • Connect multiple systems within a single and uniform directory tree

mount arguments

  • FS type
  • partition
  • mount point

internals

  • Read in-storage superblock and generate in-memory superblock structure
profile
Dev Ops, "Git, Linux, Docker, Kubernetes, ansible, " .

0개의 댓글