[CentOS] How to make fdisk recognize increased iSCSI LUN?

Sat Nov 17 07:40:13 UTC 2007
Mindaugas <ml at kilimas.com>

  Hi,

> >   How to explain to fdisk that /dev/sda size changed? I 
> > increased LUN on storage, reloaded iscsi, did echo 1 > 
> > /sys/<something>/rescan. And I see in "dmesg" that kernel 
> > found new size of the LUN. But when I type "fdisk /dev/sda" 
> > it still shows old size. On /dev/sda1 sits LVM PV and I'd 
> > like to resize it instead of adding one more PV to volume group.
> > 
> 
> I think it may be the MBR that still has the old size in it.
> 
> Try opening it in fdisk, save it, then re-open it.

  Probably. But opening and saving does not help. "partprobe /dev/sda" does not help too.

  Mindaugas

dmesg:
SCSI device sda: 1048576000 512-byte hdwr sectors (536871 MB)
SCSI device sda: drive cache: write through

#  fdisk /dev/sda

The number of cylinders for this disk is set to 26108.
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)

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       26108   209712478+  8e  Linux LVM

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

# partprobe /dev/sda

# fdisk -l /dev/sda

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       26108   209712478+  8e  Linux LVM