Well, Filesystems may sound very simple concepts specially in Unix environments but there are some interesting limitations and tricks which a Unix admin must keep in mind working with.
I'm taking some notes about filesystems and very simple definitions specifically for common file systems in Linux. I'll also include my references in here. Some are interesting.
A bit of reading about Inodes and Unix filesystem features
Unix Inodes
Many Unix filesystems (Berkeley Fast Filesystem, Linux ext2fs, Sun ufs, ...) take an approach that combines some of the ideas above.
Disk Allocation Considerations
limitations on file size, total partition size
internal, external fragmentation
overhead to store and access index blocks
layout of files, inodes, directories, etc, as they affect performance -
disk head movement, rotational latency - many unix filesystems keep
clusters of inodes at a variety of locations throughout the file
system, to allow inodes and the disk blocks they reference to be close
together
may want to reorganize files occasionally to improve layout (see
hw7 question)
Free Space Management
With any of these methods of allocation, we need some way to keep track of free disk blocks.
Two main options:
I'm taking some notes about filesystems and very simple definitions specifically for common file systems in Linux. I'll also include my references in here. Some are interesting.
A bit of reading about Inodes and Unix filesystem features
Unix Inodes
Many Unix filesystems (Berkeley Fast Filesystem, Linux ext2fs, Sun ufs, ...) take an approach that combines some of the ideas above.
Disk Allocation Considerations
With any of these methods of allocation, we need some way to keep track of free disk blocks.
Two main options:
Caching is an important optimization for disk accesses.
A disk cache may be located:
Safety and Recovery
When a disk cache is used, there could be data in memory that has been "written" by programs, which which has not yet been physically written to the disk. This can cause problems in the event of a system crash or power failure.
If the system detects this situation, typically on bootup after such a failure, a consistency checker is run. In Unix, this is usually the fsck program, and in Windows, scandisk or some variant. This checks for and repairs, if possible, inconsistencies in the filesystem.
Journaling Filesystems
One way to avoid data loss when a filesystem is left in an inconsistent state is to move to a log-structured or journaling filesystem.
From: Ext4 filesystem layout
Overview
An ext4 file system is split into a series of block groups. To reduce performance difficulties due to fragmentation, the block allocator tries very hard to keep each file's blocks within the same group, thereby reducing seek times. The size of a block group can be calculated as 8 *
block_size_in_bytes
. With the default block size of 4KiB, each group will contain 32,768 blocks, for a length of 128MiB. ( It's a good to group things. )Blocks
ext4 allocates storage space in units of "blocks". A block is a group of sectors between 1KiB and 64KiB, and the number of sectors must be an integral power of 2. Blocks are in turn grouped into larger units called block groups. Block size is specified at mkfs time and typically is 4KiB. You may experience mounting problems if block size is greater than page size (i.e. 64KiB blocks on a i386 which only has 4KiB memory pages). By default a filesystem can contain 2^32 blocks; if the '64bit' feature is enabled, then a filesystem can have 2^64 blocks.
32-bit mode | 64-bit mode | ||||||||
Item | 1KiB | 2KiB | 4KiB | 64KiB | 1KiB | 2KiB | 4KiB | 64KiB | |
---|---|---|---|---|---|---|---|---|---|
Blocks | 2^32 | 2^32 | 2^32 | 2^32 | 2^64 | 2^64 | 2^64 | 2^64 | |
Inodes | 2^32 | 2^32 | 2^32 | 2^32 | 2^32 | 2^32 | 2^32 | 2^32 | |
File System Size | 4TiB | 8TiB | 16TiB | 256PiB | 16ZiB | 32ZiB | 64ZiB | 1YiB |
( Nice, so It's actually the System's architecture dictating the maximum filesystem's size. 2 to the power of 32 or 64 and you may have some playroom with your block size but you must stick to blocks as big as your memory page size. But, Can't I mount the file systems created on bigger machines on smaller ones ? Seems we may have difficulties. So don't be sure unless you've tried it. )
Layout
The layout of a standard block group is approximately as follows (each of these fields is discussed in a separate section below):Group 0 Padding | ext4 Super Block | Group Descriptors | Reserved GDT Blocks | Data Block Bitmap | inode Bitmap | inode Table | Data Blocks |
1024 bytes | 1 block | many blocks | many blocks | 1 block | 1 block | many blocks | many more blocks |
Still to continue.....
No comments:
Post a Comment