That's a normal behavior. While the disk is not labeled, a fake label is
generated depending on the size of the disk. Once the disk is labeled, the
label information is written on the disk and that information is used
whatever the actual size of the disk is. If the size of the disk has changed,
and the disk already has a label then that label needs to be updated to match
with the new disk size.

  If you are using OpenSolaris and your disk has an EFI label then you can use
the "expand" subcommand from format(1m). Otherwise, you will have to use some
tricks with format(1m) especially if you want to keep your existing partitions.

  Here is how you can do that:

  - If your disk has a VTOC label (that's your case):

    . save the current disk VTOC with prtvtoc(1m), in case something goes wrong
      you will be able to restore the initial label using fmthard(1m)

    . save the output of "format" -> "verify"

    . change the disk label to an EFI label:
      use "format -e" then "label" and select EFI label

    . change the disk label back to a VTOC label:
      use "format -e" then "label" and select VTOC label

      Now you need to recreate the initial partitions. To do that you first 
need to
      check that the cylinder size of the disk geometry hasn't changed. If it 
has
      changed then you will be unable to recreate the initial partitions.

    . run "format" -> "verify" and check that "nhead" and "nsect" are the same
      as before the geometry was changed (from the "format" -> "verify" output
      that was initially saved)

    . recreate partitions (except slice 2) from the initial "format" -> "verify"
      output. Do not change slice 2.

    . use "label" when you have done to write the new label and partitions

  - If your disk has an EFI label (and you are using Solaris 10):

    . save the current disk VTOC with prtvtoc(1m), in case something goes wrong
      you will be able to restore the initial label using fmthard(1m)

    . save the output of the "format" -> "verify"

    . run "format" -> "verify" and check the value in "sectors = "

    . run "format" -> "type", select "other" and set the "maximum number of 
LBAs:"
      to the value from "sectors = "

    . recreate partitions from the initial "format" -> "verify" output.

    . use "label" when you have done to write the new label and partitions


alex.


On 08/06/09 12:17, Russell Hansen wrote:
> Doing a little experimenting with LDoms on a T5240 we've got I've run into an 
> interesting scenario with disk resizing.
> 
> LDoms 1.2
> Solaris 10 u7 (host and guest)
> 
> I'm using ZFS as a back-end for my guests.  When I first create the volumes 
> and add them to the guests I can resize them all I want.  The moment I label 
> them in the guest through format (or add them to a ZFS pool which gives an 
> EFI label) it seems I can no longer resize them.
> 
> Example:
> 
> ------------------------------------------------------------------------------
> 
> [root at host ~]# zfs create -V 10G ldoms/guest/data
> [root at host ~]# ldm add-vdsdev /dev/zvol/dsk/ldoms/guest/data vol1 at 
> primary-vds0
> [root at host ~]# ldm add-vdisk vdisk1 vol1 at primary-vds0 guest
> 
> ------------------------------------------------------------------------------
> 
> [root at guest ~]# format
> format> verify
> 
> Volume name = <        >
> ascii name  = <SUN-DiskImage-10GB cyl 34950 alt 2 hd 1 sec 600>
> pcyl        = 34952
> ncyl        = 34950
> acyl        =    2
> nhead       =    1
> nsect       =  600
> Part      Tag    Flag     Cylinders         Size            Blocks
>   0 unassigned    wm       0                0         (0/0/0)            0
>   1 unassigned    wm       0                0         (0/0/0)            0
>   2     backup    wm       0 - 34949       10.00GB    (34950/0/0) 20970000
>   3 unassigned    wm       0                0         (0/0/0)            0
>   4 unassigned    wm       0                0         (0/0/0)            0
>   5 unassigned    wm       0                0         (0/0/0)            0
>   6 unassigned    wm       0                0         (0/0/0)            0
>   7 unassigned    wm       0                0         (0/0/0)            0
> 
> ------------------------------------------------------------------------------
> 
> [root at host ~]# zfs set volsize=15G ldoms/guest/data
> 
> ------------------------------------------------------------------------------
> 
> [root at guest ~]# format
> format> verify
> 
> Volume name = <        >
> ascii name  = <SUN-DiskImage-15GB cyl 52426 alt 2 hd 1 sec 600>
> pcyl        = 52428
> ncyl        = 52426
> acyl        =    2
> nhead       =    1
> nsect       =  600
> Part      Tag    Flag     Cylinders         Size            Blocks
>   0 unassigned    wm       0                0         (0/0/0)            0
>   1 unassigned    wm       0                0         (0/0/0)            0
>   2     backup    wm       0 - 52425       15.00GB    (52426/0/0) 31455600
>   3 unassigned    wm       0                0         (0/0/0)            0
>   4 unassigned    wm       0                0         (0/0/0)            0
>   5 unassigned    wm       0                0         (0/0/0)            0
>   6 unassigned    wm       0                0         (0/0/0)            0
>   7 unassigned    wm       0                0         (0/0/0)            0
> 
> format> label
> format> verify
> 
> Volume name = <        >
> ascii name  = <SUN-DiskImage-15GB cyl 52426 alt 2 hd 1 sec 600>
> pcyl        = 52428
> ncyl        = 52426
> acyl        =    2
> nhead       =    1
> nsect       =  600
> Part      Tag    Flag     Cylinders         Size            Blocks
>   0 unassigned    wm       0                0         (0/0/0)            0
>   1 unassigned    wm       0                0         (0/0/0)            0
>   2     backup    wm       0 - 52425       15.00GB    (52426/0/0) 31455600
>   3 unassigned    wm       0                0         (0/0/0)            0
>   4 unassigned    wm       0                0         (0/0/0)            0
>   5 unassigned    wm       0                0         (0/0/0)            0
>   6 unassigned    wm       0                0         (0/0/0)            0
>   7 unassigned    wm       0                0         (0/0/0)            0
> 
> ------------------------------------------------------------------------------
> 
> [root at host ~]# zfs set volsize=20G ldoms/guest/data
> 
> ------------------------------------------------------------------------------
> 
> [root at guest ~]# format
> format> verify
> 
> Volume name = <        >
> ascii name  = <SUN-DiskImage-15GB cyl 52426 alt 2 hd 1 sec 600>
> pcyl        = 52428
> ncyl        = 52426
> acyl        =    2
> nhead       =    1
> nsect       =  600
> Part      Tag    Flag     Cylinders         Size            Blocks
>   0 unassigned    wm       0                0         (0/0/0)            0
>   1 unassigned    wm       0                0         (0/0/0)            0
>   2     backup    wm       0 - 52425       15.00GB    (52426/0/0) 31455600
>   3 unassigned    wm       0                0         (0/0/0)            0
>   4 unassigned    wm       0                0         (0/0/0)            0
>   5 unassigned    wm       0                0         (0/0/0)            0
>   6 unassigned    wm       0                0         (0/0/0)            0
>   7 unassigned    wm       0                0         (0/0/0)            0
> 
> ------------------------------------------------------------------------------
> 
> Is there some magic command I'm missing or did I misinterpret Bug ID 6699271 
> and/or patch ID 139562-02?
> 
> http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6699271
> http://sunsolve.sun.com/search/document.do?assetkey=1-21-139562-02-1

Reply via email to