Abstract
- A Data Structure with features that the Kernel uses to control how data is stored and retrieved on a storage device
- Provides a way to organise File Directory into folders, and to keep track of which File are stored where on the device
List the filesystem of attached block device
MacOS
Manipulate Filesystem with
mkfs
Format a storage device to specific filesystem with
sudo mkfs -t <FILESYSTEM_TYPE> -f /dev/<STORAGE_NAME>
.
Check the storage size of current directory recursively
-s
means summary-h
means human-readable
Disk re-sizing
You can refer to Increase the size of a persistent disk | Google Cloud to play with re-sizing a file system.
Mounted File System
- With
mount
System Call (系统调用), we are able to mount an isolated File System to another isolated File System
Always perform
mount
on empty file directoryOtherwise, the File in the mounted Directory of the original File System can’t be accessed
List mounted file system
Linux
Mount a device to a directory
Mounting automatically during boot time
You can achieve this by editing the
/etc/fstab
. You can verify the configuration withsudo mount -a
.
Common File Systems
APFS
- Apple File System
- Created by Apple, used for macOS, iOS, iPadOS, tvOS, and watchOS
- We need to use FUSE to mount APFS on Linux Kernel. One common option is sgan81/apfs-fuse
Ext4
- Extended Filesystem 4
- The default choice on many Linux distributions. Mature, stable, and offers good all-around performance
- Commonly used in Linux Kernel
exFAT
- EXtended File Allocation Table
- Windows standard filesystem, both macOS and Linux Kernel support
- Designed as a successor to FAT32, specifically for flash drives and other external storage. Handles large files and better cross-compatibility than FAT32
ZFS
- Zettabyte File System
- Originally from Solaris, known for extreme scalability, data integrity protection, and comprehensive features (snapshots, compression, volumes). Can be resource-intensive
- Commonly used in Linux Kernel