Tuesday, December 5, 2017

How to modify the EFI label for a LUN that was online expanded and that belongs to a zpool







Solaris Operating System - Version 10 3/05 to 11.3 [Release 10.0 to 11.0]
Information in this document applies to any platform.


A zpool can become suspended after online expanding a LUN that belongs to the zpool after using the "Auto configure" option from the format utility.  The objective of this article is to prevent such problems.


Solution


Note: In Solaris 10, the patch 148098-03 (SPARC) / 148099-03 (x86) or later, needs to be installed for this procedure to work.


Before modifying the LUN and the zpool, make sure you have a backup of the data in the zpool and save the prtvtoc(1) output of each of the LUNs that are going to be modified:

# prtvtoc /dev/rdsk/c0t600144F0E1765470000056DDFBAC0001d0s2 > /var/tmp/c0t600144F0E1765470000056DDFBAC0001d0-label.txt

Also, make sure that the ZFS autoexpand property is set to on:

# zpool set autoexpand=on tank
# zpool get autoexpand tank
NAME  PROPERTY    VALUE  SOURCE
tank  autoexpand  on     local

Now proceed to add the space to the LUN(s) and follow the next steps to modify or verify that the label of the LUN recognizes the added space:

1. Use "format -e  <LUN>" to verify/modify the label of the LUN.
2. Select the "partition" option from the format menu.
3. Select "print" to review the partition table, verify partition zero starts at block 256 and has all the space assigned to it, except for the slice eight that will have 8 MB. Verify if the partition table reports the added space. Use the prtvtoc(1) output that was saved in the beginning to compare if needed.
4. If the new space is not reported use the "expand" option from the format->partition sub menu.
5. Print again the partition table, the new space should be visible on the second line, where it say "Total disk sectors available: XXXXXXX  + 16834 (reserved sectors)". Save the value of the first sector of the partition 8.
6. Type "0" on the "partition>" prompt to modify the first partition.
7. Accept the defaults for partition id tag, permission, starting sector (it should be 256).
8. Calculate the last sector of the partition zero by subtracting one from the first sector of the partition 8 noted on step #5. For example, if the first sector for partition 8 is 4177887 then use 4177886e (the "e" denotes the ending sector) on the prompt "Enter partition size". The character "$" can be used so the partition uses all available space.
9. Print again the partition table, make sure that this time the first partition starts at 256 and has the new space added to it. Do not proceed to the next step if the starting sector of the first partition is 34 or any number different from 256.
10. Type the command "label" to save the label to the disk. Select EFI if prompted for the label type and quit the format utility.
11. Check with "zpool list" if the zpool is now expanded. If not, use the command "zpool online -e <zpool_name> <LUN>" to expand the space and verify again if the space is now visible.

Important considerations:
1. Never use the "type -> Auto configure" option from the format facility.
2. Never label a LUN used by ZFS if the starting sector for the first partition is 34 or anything different from 256 for a zpool using whole disks labeled as EFI.
3. If the zpool was created created against the slice 0 of an EFI LUN (instead of using the whole disk), then the starting sector could be 34, the important consideration is that after adding the space and changing the label, the starting sector should remain the same.

The following is an example of the procedure outlined above:
# format -e c0t600144F0E1765470000056DDFBAC0001d0

c0t600144F0E1765470000056DDFBAC0001d0: configured with capacity of 1023.75MB
selecting c0t600144F0E1765470000056DDFBAC0001d0
[disk formatted]


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show disk ID
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> partition


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        expand - expand label to use the maximum allowed space
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> print
Current partition table (original):
Total disk sectors available: 2080701 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector       Size       Last Sector
  0        usr    wm               256   1015.86MB        2080734  
  1 unassigned    wm                 0         0             0  
  2 unassigned    wm                 0         0             0  
  3 unassigned    wm                 0         0             0  
  4 unassigned    wm                 0         0             0  
  5 unassigned    wm                 0         0             0  
  6 unassigned    wm                 0         0             0  
  8   reserved    wm           2080735      8.00MB        2097118

partition> expand
The expanded capacity is added to the unallocated space.

partition> print
Current partition table (original):
Total disk sectors available: 4177853 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector       Size       Last Sector
  0        usr    wm               256   1015.86MB        2080734  
  1 unassigned    wm                 0         0             0  
  2 unassigned    wm                 0         0             0
  3 unassigned    wm                 0         0             0  
  4 unassigned    wm                 0         0             0
  5 unassigned    wm                 0         0             0  
  6 unassigned    wm                 0         0             0  
  8   reserved    wm           4177887      8.00MB        4194270  

partition> 0 
Part      Tag    Flag     First Sector       Size       Last Sector
  0        usr    wm               256      1.99GB        4177885

Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting sector[256]:
Enter partition size[4177630b, 4177885e, 2039mb, 1gb, 0tb]: 4177886e
partition> print
Current partition table (unnamed):
Total disk sectors available: 4177853 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector       Size       Last Sector
  0        usr    wm               256      1.99GB        4177886  
  1 unassigned    wm                 0         0             0  
  2 unassigned    wm                 0         0             0  
  3 unassigned    wm                 0         0             0  
  4 unassigned    wm                 0         0             0  
  5 unassigned    wm                 0         0             0  
  6 unassigned    wm                 0         0             0  
  8   reserved    wm           4177887      8.00MB        4194270

partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]:
Ready to label disk, continue? y

No comments:

Post a Comment