wiki:TipAndDoc/storage/filesystem/ext4

Version 4 (modified by mitty, 12 years ago) (diff)

--

ext4lazyinit

  • Ubuntu 12.04.1 x86_64で作ったext4のfeature
    • sudo mkfs.ext4 /dev/md0 -m 1
    • sudo tune2fs -l /dev/md0
      Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
      Filesystem flags:         signed_directory_hash
      Default mount options:    user_xattr acl
      
  • man mke2fs
           -E extended-options
                       lazy_itable_init[= <0 to disable, 1 to enable>]
                              If enabled and the uninit_bg feature is enabled, the
                              inode table will not be fully initialized by mke2fs.
                              This speeds up filesystem initialization noticeably,
                              but it requires the kernel  to  finish  initializing
                              the filesystem in the background when the filesystem
                              is first mounted.  If the option value  is  omitted,
                              it defaults to 1 to enable lazy inode table zeroing.
    
                       lazy_journal_init[= <0 to disable, 1 to enable>]
                              If  enabled,  the  journal  inode  will not be fully
                              zeroed out by mke2fs.   This  speeds  up  filesystem
                              initialization  noticeably,  but  carries some small
                              risk if the system crashes before  the  journal  has
                              been  overwritten  entirely one time.  If the option
                              value is omitted, it defaults to 1  to  enable  lazy
                              journal inode zeroing.
    
    (snip)
    
           -O feature[,...]
                       uninit_bg
                              Create a filesystem without initializing all of  the
                              block  groups.   This feature also enables checksums
                              and highest-inode-used  statistics  in  each  block‐
                              group.   This  feature  can speed up filesystem cre‐
                              ation  time  noticeably  (if   lazy_itable_init   is
                              enabled),  and  can also reduce e2fsck time dramati‐
                              cally.  It is only supported by the ext4  filesystem
                              in recent Linux kernels.
    
  • /etc/mke2fs.conf
    [defaults]
            base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
            default_mntopts = acl,user_xattr
            enable_periodic_fsck = 0
            blocksize = 4096
            inode_size = 256
            inode_ratio = 16384
    
    [fs_types]
            ext3 = {
                    features = has_journal
            }
            ext4 = {
                    features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
                    auto_64-bit_support = 1
                    inode_size = 256
            }
            ext4dev = {
                    features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
                    inode_size = 256
                    options = test_fs=1
            }
    
  • lvm - mkfs.ext4 is taking hours to complete on 4TB raid 5 - Server Fault

    Note that lazy_itable_init is turned on by default if the kernel you are running supports automatic background initialization of the inode table ( 2.6.37+ ). Without that support, enabling this option is unsafe as it leaves the inode tables uninitialized, so they may contain garbage that fsck will mistake as valid inodes under certain circumstances. Also uninit_bg is enabled by default for ext4.

Very long mount times of large ext4 filesystems - 12.04.1 LTS

  • TB級のext4をマウントしようとすると、数分以上待たされる