mkfs 使用

 

 

 


常用 Options

  • -c     Check  the  device  for  bad  blocks before creating the file system.(fast read-only test)
  • -L     new-volume-label ( 另有指定用某 UUID:  -U UUID)
  • -m    reserved-blocks-percentage

Example:

mkfs.ext4 -m 0 -L backupdisk /dev/DEVICE

其他有用 opts

-n     Causes mke2fs to not actually create a filesystem

-v     Verbose execution


設定檔

 

/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
        }
....................
        small = {
                blocksize = 1024
                inode_size = 128
                inode_ratio = 4096
        }
        big = {
                inode_ratio = 32768
        }

 

discard

any subsequent read  after  the  discard  and  before write  returns zero

(mark all not-yet-zeroed inode tables as zeroed.)

resize=max-online-resize

保留空間, 留代可以max-online-resize

 


feature

 

-O feature[,...]

  • dir_index
  • extent (scheme storing the location of data blocks in an inode)
  • filetype
  • flex_bg (per-block group metadata)
  • sparse_super (fewer  superblock  backup  copies)
  • quota (quotas  will  be  enabled  automatically  when  the  filesystem is mounted.)
  • resize_inode ( reserve enough space, default grow  to  1024  times  its initial size)

 


ext3

 

-b block-size        # Valid block size vales are 1024, 2048 and 4096 bytes per block.

-T fs-type             # Specify  how the filesystem is going to be used

news        one inode per 4kb block

largefile   one inode per megabyte

largefile4  one inode per 4 megabytes

-j                      # Create the filesystem with an ext3 journal. (Default)

-J journal-options

size=journal-size

device=external-journal