Expanding a LUN on Solaris x86 - fdisk problems
We have some Solaris 10 x86 servers connected to one of our our SANs and wanted to add some extra disk space. This is normally straightforward on Sun Sparc servers, however we ran into a few problems on the x86 servers. Format would not show the correct LUN size, even after trying to auto-configure the device type. Turns out we had forgotten that we were using x86 servers and that fdisk was needed to increase the LUN size before going into format.
Total disk size is 32635 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 32634 32634 100
SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Exit (update disk configuration and exit)
6. Cancel (exit without updating disk configuration)
Enter Selection: 6
At this point we tried a few things and one of them was to delete all partitions and save that. Big mistake. We couldn’t get back into fdisk.
$ sudo fdisk /dev/rdsk/c4t0d0p0 fdisk: Cannot open device /dev/rdsk/c4t0d0p0.
Not good. How could we get back into the disk. We tried putting a new boot block on the device
$ sudo fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c4t0d0p0 fdisk: Cannot open device /dev/rdsk/c4t0d0p0.
Still no joy. Finally we had to create a file with format similar to the output from ptrvtoc and then use that to partition the disk.
$ cat /path_to_file * Label geometry for device /dev/rdsk/c4t0d0p0 * PCYL NCYL ACYL BCYL NHEAD NSECT SECSIZ 16383998 16383998 2 0 1 2150 512 $ sudo fdisk -S /path_to_file -I /dev/rdsk/c4t0d0p0
And finally we could get back into fdisk, delete all the partitions and create just one partition using the whole disk. Then the normal format command to partition the disk correctly and make filesystems, mount etc.
The easy route next time - never delete all the fdisk partitions and save/exit from fdisk!


(2 votes, average: 3.5 out of 5)
April 27th, 2007 at 12:31 pm
Top banana - wish I had thought of that earlier
September 10th, 2007 at 9:14 pm
Ah, the old ladder syndrome. Many is the time I did this and wiped or went one stage too far and then spent a wee while trying to recover.
As one of my trusted carpenter friends thought me… Measure x 2, cut x 1.
:-)
Joe.