The Second Extended File System Internal Layout
Total Page:16
File Type:pdf, Size:1020Kb
The Second Extended File System Internal Layout Dave Poirier <[email protected]> The Second Extended File System: Internal Layout by Dave Poirier Copyright © 2001-2019 Dave Poirier Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be acquired electronically from http://www.fsf.org/licenses/fdl.html or by writing to 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Table of Contents About this book ............................................................................................................... viii 1. Historical Background ...................................................................................................... 1 2. Definitions ..................................................................................................................... 2 Blocks ....................................................................................................................... 2 Block Groups ............................................................................................................. 3 Directories ................................................................................................................. 3 Inodes ....................................................................................................................... 3 Superblocks ................................................................................................................ 4 Symbolic Links ........................................................................................................... 4 3. Disk Organization ............................................................................................................ 6 Superblock ................................................................................................................. 7 s_inodes_count ................................................................................................... 9 s_blocks_count ................................................................................................... 9 s_r_blocks_count ................................................................................................. 9 s_free_blocks_count ............................................................................................. 9 s_free_inodes_count ............................................................................................. 9 s_first_data_block ................................................................................................ 9 s_log_block_size ............................................................................................... 10 s_log_frag_size ................................................................................................. 10 s_blocks_per_group ........................................................................................... 10 s_frags_per_group .............................................................................................. 10 s_inodes_per_group ........................................................................................... 10 s_mtime ........................................................................................................... 11 s_wtime ........................................................................................................... 11 s_mnt_count ..................................................................................................... 11 s_max_mnt_count .............................................................................................. 11 s_magic ........................................................................................................... 11 s_state ............................................................................................................. 11 s_errors ............................................................................................................ 11 s_minor_rev_level .............................................................................................. 12 s_lastcheck ....................................................................................................... 12 s_checkinterval .................................................................................................. 12 s_creator_os ...................................................................................................... 12 s_rev_level ....................................................................................................... 12 s_def_resuid ..................................................................................................... 12 s_def_resgid ..................................................................................................... 12 s_first_ino ........................................................................................................ 13 s_inode_size ..................................................................................................... 13 s_block_group_nr .............................................................................................. 13 s_feature_compat ............................................................................................... 13 s_feature_incompat ............................................................................................ 13 s_feature_ro_compat .......................................................................................... 14 s_uuid .............................................................................................................. 14 s_volume_name ................................................................................................. 14 s_last_mounted .................................................................................................. 14 s_algo_bitmap ................................................................................................... 14 s_prealloc_blocks .............................................................................................. 15 s_prealloc_dir_blocks ......................................................................................... 15 s_journal_uuid .................................................................................................. 15 s_journal_inum .................................................................................................. 15 s_journal_dev .................................................................................................... 15 iii The Second Extended File System s_last_orphan .................................................................................................... 15 s_hash_seed ...................................................................................................... 15 s_def_hash_version ............................................................................................ 16 s_default_mount_options ..................................................................................... 16 s_first_meta_bg ................................................................................................. 16 Block Group Descriptor Table ..................................................................................... 16 bg_block_bitmap ............................................................................................... 16 bg_inode_bitmap ............................................................................................... 17 bg_inode_table .................................................................................................. 17 bg_free_blocks_count ......................................................................................... 17 bg_free_inodes_count ......................................................................................... 17 bg_used_dirs_count ............................................................................................ 17 bg_pad ............................................................................................................. 17 bg_reserved ...................................................................................................... 17 Block Bitmap ............................................................................................................ 17 Inode Bitmap ............................................................................................................ 17 Inode Table .............................................................................................................. 18 i_mode ............................................................................................................ 19 i_uid ................................................................................................................ 19 i_size ............................................................................................................... 19 i_atime ............................................................................................................ 20 i_ctime ............................................................................................................ 20 i_mtime ........................................................................................................... 20 i_dtime ...........................................................................................................