4

Environment: - Virtual machine on VMWare ESX 4.0 - OS: fully up to date RHEL 5.8

After adding a new (virtual) disk I want to create an ext4 partition on LVM on this disk.

Steps taken so far:

$ sudo /sbin/fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
p
Partition number (1-4): 1
First cylinder (1-10443, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443):
Using default value 10443

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
$ sudo /usr/sbin/pvcreate /dev/sdb1
  Writing physical volume data to disk "/dev/sdb1"
  Physical volume "/dev/sdb1" successfully created
$ sudo /usr/sbin/vgcreate VGora /dev/sdb1
  /dev/hdc: open failed: No medium found
  Volume group "VGora" successfully created
$ sudo /usr/sbin/lvcreate -l "100%FREE" -n oradata VGora
  Logical volume "oradata" created

Creating an ext4 partition fails:

$ sudo /sbin/mke2fs -t ext4 /dev/VGora/oradata
mke2fs 1.39 (29-May-2006)
mke2fs: invalid blocks count - /dev/VGora/oradata

More information on the created partition:

$ sudo /usr/sbin/vgdisplay VGora
  --- Volume group ---
  VG Name               VGora
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               80.00 GB
  PE Size               4.00 MB
  Total PE              20479
  Alloc PE / Size       20479 / 80.00 GB
  Free  PE / Size       0 / 0
  VG UUID               ggjERV-sGbG-1nCv-HW61-LJk4-I7cX-Z3Infh

$ sudo /usr/sbin/lvdisplay VGora
  --- Logical volume ---
  LV Name                /dev/VGora/oradata
  VG Name                VGora
  LV UUID                nia1PK-7JJ2-jg5T-uN4X-ggYH-R0mS-oqCooY
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                80.00 GB
  Current LE             20479
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

$ sudo /sbin/fdisk -l /dev/sdb

Disk /dev/sdb: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10443    83883366   8e  Linux LVM

I can't find any relevant information on this error and don't know how to resolve this.

  • How can I check the block count? and
  • How can I correct it to a valid number for ext4?
0

2 Answers 2

9

It's bad error checking in the argument parsing I think causing that message. The version of mke2fs on RHEL 5 doesn't support the -t type argument, so it's somehow parsing the /dev/VGora/oradata path as the last (optional) block count argument.

Anyway, the way you'll want to do it is to ensure you have e4fsprogs installed and then use mkfs.ext4 /dev/VGora/oradata or mke4fs.

2
  • Just to help the next poor soul to stumble into this. I just found that resizing an ext4 file system on RHEL (5.8 in my case) requires the use of resize4fs and e4fsck rather than their ext2 counter parts. Contrary to ext3 ext4 requires the specific tools to be used. I've opened a bug report to have the storage guides updated accordingly.
    – Bram
    Jun 6, 2012 at 10:03
  • On ubuntu 16, I can't seem to find e4fsprogs... Oct 17, 2020 at 1:26
0
mkfs.ext3 -f /dev/sdb5
mkfs.ext3: invalid fragment size - /dev/sdb5

it was not working in RHEL5 when I tried without -f its work.

mkfs.ex3 /dev/sdb5 

mkfs.ext3 /dev/sdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
78856192 inodes, 157694024 blocks
7884701 blocks (5.00%) reserved for the super user
2
  • What were the thanks in your answer for? Please read the tour (focus on No chit-chat), as this is not some forum, where one would go if such time wasting niceties don't bother you. You answer uses a real disc, are you sure your answer will work for the OPs environment (virtual dis on LVM?)
    – Anthon
    Aug 14, 2017 at 5:14
  • A similar problem: mke4fs -n ROOT_FS /dev/sdc2 is solved by dropping the -n ROOT_FS naming. The error needs to be a lot clearer.
    – Owl
    Jul 30, 2018 at 10:59

You must log in to answer this question.

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