6

My partition table looks like this:

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    32505855    16251904   83  Linux
/dev/sda2        32505856    33554431      524288   83  Linux

When I went to lay down a filesystem on sda2, it threw this error:

sudo mkfs -t ext4 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
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).

I have tried both with an extended partition and a primary partition and get the same error. I have Ubuntu 14.04TLS. What to do?

1
  • You reached 15 point of reputation, from now you can upvote questions (next to accepting them), if you are satisfied with them.
    – peterh
    Commented Aug 29, 2014 at 14:15

4 Answers 4

6

1: it doesn't have to do anything with primary/extended/logical partitions.

2: I think you wanted to say "logical" partition instead of "extended".

3: mkfs thinks your partition size if 0 bytes. It was very surely, because the kernel wasn't able to update the partition table after a repartitioning. After you edited the partition table, didn't you get some warnings about that a reboot is needed?

On Linux, there is two different partition table: there is one on the zeroth block of the hard disk. And there is one in the kernel memory. You can read the first with an fdisk -l /dev/sda command. And the second can you read with a cat /proc/partitions command. These two need to be in sync, but it is not always possible. For example, you can't change the limits of a currently used partition. In this case, the kernel partition table won't changed.

You can let the kernel re-read the disk partition table with the command blockdev --rereadpt /dev/sda. Most partitioning tools execute this command after they wrote out your newly changed partition table to the disk.

The problem is that only newer linux kernels are capable to re-read a partition table of a used hard disk. From this viewpoint, a hard disk is considered as "used" if there is a simple partition which is used on it, either by a tool, or a mount point or it is an active swap partition.

And even these newer kernels aren't able to change the limits of a partition currently being used.

I think, your root system is on /dev/sda, thus you need to do a reboot after you did a repartitioning.

3
  • Yep, you're right. I haven't rebooted. So as you can see I wiped out my swap partition and commented it out in fstab, so do you think there will be an issue with the reboot? I have been told you really don't need a swap partition.
    – user53029
    Commented Aug 29, 2014 at 21:51
  • also, I ran the blockdev command and it failed as well so cat /proc/partitions still reflect the old kernel mapping. The error I got after running the blockdev command was a resource busy error - like I needed to reboot for that as well. Kernel is 3-13-0-29
    – user53029
    Commented Aug 29, 2014 at 21:59
  • @user53029 Sorry for the late react - ein blockdev --rereadpt /dev/sdX re-reads the partition table, if it is possible (and gives an error if it is not).
    – peterh
    Commented Oct 10, 2018 at 11:47
0

You have to run the partprobe command to update the table

0

In a RHEL8 I created the new partition extended as type "Linux".

I used mkfs.ext4 to format it, and partprobe, partx /dev/sda.

And after many reboots the partition remains.

0

cat /proc/partitions will result in

major minor  #blocks  name

   8        0  292968750 sda
   8        1    1048576 sda1
   8        2   70637568 sda2
   **8        3          1 sda3**
   8       16  292968750 sdb
   8       17  143373716 sdb1
 253        0   63463424 dm-0
 253        1    7168000 dm-1
  11        0    1048575 sr0

I did partprobe and ran cat /proc/partitions.

Now showing

major minor  #blocks  name

   8        0  292968750 sda
   8        1    1048576 sda1
   8        2   70637568 sda2
   8        3  221281582 sda3
   8       16  292968750 sdb
   8       17  143373716 sdb1
 253        0   63463424 dm-0
 253        1    7168000 dm-1
  11        0    1048575 sr0

After above results. I ran below command successfully.

mkfs -t ext4 /dev/sda3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .