[CentOS] Rescan harddisk size without rebooting

Aleksandar Milivojevic alex at milivojevic.org
Sun Nov 13 04:28:17 UTC 2005

kadafax wrote:
> Hi list,
> I have a SAN attached to a CentOS 4.2 server. I have expanded the size 
> of the virtual disk within the SAN (by adding a new HD to the disk pool) 
> and need CentOS to see the new size (CentOS see it as /dev/sdb). I'm 
> using LVM. Do you  know a method for the Volume Group to see that one of 
> its harddisk is now bigger, without rebooting (it's not a problem with a 
> reboot but since the LDAP directory is on this server, it is problematic).

If you do "fdisk /dev/sdb", does it show you correct (new) size?  Fdisk 
should query device directly (and not relay on cached copy of partition 
table in kernel).  If yes, just extend partition where your physical 
volume is, save new partition table (fdisk will instruct kernel to 
re-read it), do pvresize, lvresize, and finally resize the file system 
(this can be done while file system is mounted at least for ext2 and 
ext3).  If your version of LVM reports that pvresize is non-functional 
(I believe pvresize was implemented relatively recently for LVM2), 
there's couple of "dirty" tricks how to resize physical volume.

More information about the CentOS mailing list