OSTEP Chapter 41

ECE 3600, Fall 2022


Table of Contents


1. Fragmentation


2. Cylinder Groups


3. Block Groups

in each group

keep related stuff together, unrelated stuff far apart

balance allocation of directories

allocate file data in same group as inode and directory


4. Examples

Using ffs.py:
$ cat in.example1

dir /a
dir /b
file /a/c 2
file /a/d 2
file /a/e 2
file /b/f 2

$ python ./ffs.py -f in.example1 -c -d 10

group inodes     data
    0 /--------- /---------
    1 acde------ accddee---
    2 bf-------- bff-------
    3 ---------- ----------
    4 ---------- ----------
    5 ---------- ----------
    6 ---------- ----------
    7 ---------- ----------
    8 ---------- ----------
    9 ---------- ----------

$ python ./ffs.py -f in.example1 -c -d 10 -I

group inodes     data
    0 /--------- /---------
    1 a--------- a---------
    2 b--------- b---------
    3 c--------- cc--------
    4 d--------- dd--------
    5 e--------- ee--------
    6 f--------- ff--------
    7 ---------- ----------
    8 ---------- ----------
    9 ---------- ----------

5. Large Files

$ cat in.example2

file /a 30

$ python ./ffs.py -f in.example2 -c

group inodes     data
    0 /a-------- /aaaaaaaaa aaaaaaaaaa aaaaaaaaaa
    1 ---------- a--------- ---------- ----------
    2 ---------- ---------- ---------- ----------
    3 ---------- ---------- ---------- ----------
    4 ---------- ---------- ---------- ----------
    5 ---------- ---------- ---------- ----------
    6 ---------- ---------- ---------- ----------
    7 ---------- ---------- ---------- ----------
    8 ---------- ---------- ---------- ----------
    9 ---------- ---------- ---------- ----------

$ python ./ffs.py -f in.example2 -c -L 4

group inodes     data
    0 /a-------- /aaaa----- ---------- ----------
    1 ---------- aaaa------ ---------- ----------
    2 ---------- aaaa------ ---------- ----------
    3 ---------- aaaa------ ---------- ----------
    4 ---------- aaaa------ ---------- ----------
    5 ---------- aaaa------ ---------- ----------
    6 ---------- aaaa------ ---------- ----------
    7 ---------- aa-------- ---------- ----------
    8 ---------- ---------- ---------- ----------
    9 ---------- ---------- ---------- ----------