
Brian May wrote:
Hello,
Just want to double check my facts before I do something wrong here.
I discovered a computer trying to read past the end of it's disk.
attempt to access beyond end of device sdq: rw=0, want=488022554, limit=488017920
This is probably because the partition extends beyond the end of the disk, or the filesystem extends beyond the end of the partition/disk.
My assumption is that specifying end=30378 is invalid for a disk that only has 30377 cylinders. Have I got this correct? Another identical computer does have end=30377, so I suspect this one got it right.
I would completely avoid CHS. My preference also runs to parted beats sfdisk beats fdisk (but note that modern fdisk is implemented on top of libparted). $ parted /dev/sdq unit b print The stuff coming out of the kernel is probably in 512b blocks, cf. /proc/partitions.
/dev/sdq2 is LVM, and has three partitions for root, swap, and var. How do I recover the LVM partition with minimum disruption?
Insert another disk. Make it a PV. Move the LVs to it. Remove the original disk from the VG, make it a new PV that fits on the disk, then add it to the VG and move all the LVs back onto the original disk. Finally, remove the temporary disk.
Maybe use of pvresize? Before or after fixing the partition size?
That would probably be better than my suggestion above. You probably want to do it beforehand -- it will depend on whether LVM metadata is allocated from the end of the partition or at the start. Similar fun is encountered with md arrays.
How can I check if that part of the disk has a LV allocated on it?
lvdisplay and friends should be able to list all extents. The extents will probably be in terms of the LVM extent size and count from the start of the PV, not the start of the disk.