[CentOS] SOLVED: LVM Input/output error

itayf at nospammail.net itayf at nospammail.net
Tue Jul 11 12:18:37 UTC 2006


On Thu, 6 Jul 2006, itayf at nospammail.net wrote:

> Date: Thu, 6 Jul 2006 15:36:06 +0300 (IDT)
> From: itayf at nospammail.net

> Also, I just started working with lvm.  The following warnings are genertated 
> whenever I run one of lvm commands on the external usb disk (MyBook by 
> Western Digital).

> <quote>
> [root at frodo pilpel10]# vgcreate VGe1 /dev/sdc2
>  /dev/dm-11: read failed after 0 of 4096 at 5242814464: Input/output error
>  /dev/dm-11: read failed after 0 of 4096 at 0: Input/output error
[snip]
>  Volume group "VGe1" successfully created
> [root at frodo pilpel10]# pvscan
>  /dev/dm-11: read failed after 0 of 4096 at 5242814464: Input/output error
>  /dev/dm-11: read failed after 0 of 4096 at 0: Input/output error
[snip]
>  Total: 2 [528.91 GB] / in use: 2 [528.91 GB] / in no VG: 0 [0   ]
> [root at frodo pilpel10]# lvcreate -L 202G -n LVbiogateBAK_home VGe1
>  /dev/dm-11: read failed after 0 of 4096 at 0: Input/output error
>  /dev/dm-12: read failed after 0 of 4096 at 0: Input/output error
>  /dev/dm-13: read failed after 0 of 4096 at 0: Input/output error
>  /dev/dm-14: read failed after 0 of 4096 at 0: Input/output error
>  Logical volume "LVbiogateBAK_home" created
> </quote>


The original sin was creating the physical, group, and logical 
volumes in a partition whose file system descriptor was Linux 
(Id=83) and not Linux LVM (Id=8e), the '/dev/sdc2' line below.
The (undocumented) behavior of 'parted DEVICE mkpart ...' is to 
create an ex2 fs if non is specified.

The confusing part for me was, that most of lvm operations were 
executed, and I was able to create on the LVs a seemingly-healthy 
file system (see above).

Anyway, the solution was to change the fs ID, and (to be on the 
safe side) recreate the physical, group, and logical volumes.

Below is a summary of my actions.

Huge thanks to Bill Maltby for all the help and education, and to 
Matt Hyclak for his short and crucial comment.

 	Itay


# Hard drive state before fix

[root at frodo ~]# sfdisk -l /dev/sdc

Disk /dev/sdc: 38913 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, 
counting from 0

    Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdc1   *      0+    254     255-   2048256    c  W95 FAT32 (LBA)
/dev/sdc2        255   38912   38658  310520385   83  Linux
/dev/sdc3          0       -       0          0    0  Empty
/dev/sdc4          0       -       0          0    0  Empty

# Is partition size OK?

[root at frodo ~]# dd if=/dev/sdc2 of=/dev/null
12747056+0 records in
12747056+0 records out

# As an extra safety, anticipate the next command's arguments

[root at frodo ~]# sfdisk --print-id /dev/sdc 2
83

# Now change the partition's file-system descriptor to Linux LVM

[root at frodo ~]# sfdisk --change-id /dev/sdc 2 8e
Done

# Reread partitions on the fly

[root at frodo ~]# sfdisk -R /dev/sdc
BLKRRPART: Device or resource busy
This disk is currently in use.
...

# Hmmmm... Reboot and relist partitions.
# The harddrive is usb so its identifier changed from c to b.
# Note the '/dev/sdb2/' line -- its Linux LVM -- and compare to 
# '/dev/sdc2' above.

[root at frodo ~]# sfdisk -l /dev/sdb

Disk /dev/sdb: 38913 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, 
counting from 0

    Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1   *      0+    254     255-   2048256    c  W95 FAT32 (LBA)
/dev/sdb2        255   38912   38658  310520385   8e  Linux LVM
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty

# From here, [pv|gv|lv]create, and other lvm operations went 
# smoothly, with no warnings.



More information about the CentOS mailing list