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

Sat Nov 17 19:08:02 UTC 2007
Ross S. W. Walker <rwalker at medallion.com>

Mindaugas wrote:
> 
>   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

Make sure no partitions on the volume are mounted before
running fdisk, you can't do this "live".

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.