mke2fs defaults aren't working with ext4 on Ubuntu 12.04

6,247

“Extended” is not the correct partition type. An extended partition is a special container for “logical volumes”. In essence, it’s a nested partitioning schema within the MBR schema.

Delete this partition, and create a new primary partition. It should already have the correct type (0x83, Linux filesystem) by default.

Share:
6,247

Related videos on Youtube

Alan
Author by

Alan

Updated on September 18, 2022

Comments

  • Alan
    Alan almost 2 years

    Ubuntu 12.04 LTS, I've added a new drive to the system, partitioned it with fdisk and am now trying to format it with mke2fs. The command is failing because it thinks the inodes_count and number of blocks are zero.

    NOTE: -n = simulate actions
    
    $ sudo mke2fs -c -L backups -t ext4 -T default -v -n /dev/sdc1
    mke2fs 1.42 (29-Nov-2011)
    fs_types for mke2fs.conf resolution: 'ext4'
    mke2fs: inode_size (256) * inodes_count (0) too big for a
            filesystem with 0 blocks, specify higher inode_ratio (-i)
            or lower inode count (-N).
    

    Here's the partition info from sudo fdisk /dev/sdc using the p command:

    Disk /dev/sdc: 146.8 GB, 146814976000 bytes
    61 heads, 35 sectors/track, 134308 cylinders, total 286748000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x8b4573b5
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048   286747999   143372976    5  Extended
    

    So I added that block count 143372976:

    $ sudo mke2fs -c -L backups -t ext4 -T default -v -n /dev/sdc1 143372976
    mke2fs 1.42 (29-Nov-2011)
    fs_types for mke2fs.conf resolution: 'ext4'
    Filesystem label=backups
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    8962048 inodes, 35843244 blocks
    1792162 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    1094 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872
    

    Ok, looks good. However, when I remove "-n" to actually perform the action, it says Filesystem larger than apparent device size:

    $ sudo mke2fs -c -L backups -t ext4 -T default -v /dev/sdc1 143372976
    mke2fs 1.42 (29-Nov-2011)
    mke2fs: Filesystem larger than apparent device size.
    Proceed anyway? (y,n)
    

    And when I enter y to proceed, I get a screen full of errors:

    badblocks: Invalid argument during seek
    

    What am I missing?

    EDIT

    Here are the contents of /etc/mke2fs.conf:

    $ cat /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
            }
            small = {
                    blocksize = 1024
                    inode_size = 128
                    inode_ratio = 4096
            }
            floppy = {
                    blocksize = 1024
                    inode_size = 128
                    inode_ratio = 8192
            }
            big = {
                    inode_ratio = 32768
            }
            huge = {
                    inode_ratio = 65536
            }
            news = {
                    inode_ratio = 4096
            }
            largefile = {
                    inode_ratio = 1048576
                    blocksize = -1
            }
            largefile4 = {
                    inode_ratio = 4194304
                    blocksize = -1
            }
            hurd = {
                 blocksize = 4096
                 inode_size = 128
            }
    
    • phoops
      phoops about 10 years
      Why do you use -T default? What are the contents of /etc/mke2fs.conf ?
    • phoops
      phoops about 10 years
      Just try executing mkfs.ext4 -L backups /dev/sdc1
    • Alan
      Alan about 10 years
      It was defaulting to 'floppy', presumably because the inode count was so low (zero).
    • phoops
      phoops about 10 years
      Can you try mkfs.ext4 -L backups /dev/sdc1 ?
    • Alan
      Alan about 10 years
      Same result: $ sudo mkfs.ext4 -L backups /dev/sdc1 mke2fs 1.42 (29-Nov-2011) mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N).
    • phoops
      phoops about 10 years
      I see, then check Daniel's answer, maybe that will help
  • Alan
    Alan about 10 years
    omg, that was it. I thought that because this wasn't going to be a boot drive, that it shouldn't be a primary partition. Thanks!