Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?
share|improve this question
    
+1 for a very thorough, detailed question. –  psusi Jun 5 '12 at 14:51
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Amazing, thanks a lot! –  Bram Jun 4 '12 at 15:47
    
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 '12 at 10:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.