Expanding ZFS rpool in Solaris 10
I was really bad at googling the steps to grow ZFS rpool online without using zpool append, so here is my little story how I’ve done it.
Before I begin, please, note that everything said below applies only to the configurations where rpool consumes a whole disk. If there is another partition sitting right after (or with some gap) your rpool, you’re risking to corrupt the data. So don’t blindly use the last cylinder (or “$”) when it’s time to modify the partition table.
- Here is the rpool:
- Saving the partition table first so later this information could be used to correctly re-lable (re-partition) the expanded disk. Btw, use “zpool status rpool -v” to find the device name:
- Behind the scene LUN was expanded. To confirm that luxadm could be quite handy (pay attention to “Unformatted capacity”) field:
- Time for the scariest part, i.e. re-lable the disk by installing a new partition table.
To be able to do that a new disk’s geometry must be somehow conveyed to the format utility and that’s surprisingly easy to achieve. Just run format, select the disk and use “type” option to autoconfigure it: - Notice that now it’s configured with a new capacity.
- Don’t leave the format prompt yet since we are not done. Next step is to carve out the partition table. Remember, that I only had two partitions (0 for root and 2 for backup) and your situation might be completely different, so don’t copy/paste rashly.
- Use the numbers from the menu to select the partition you’re willing to modify:
- For me, it was enough to set the size of all partitions to zero except the two: 0 (tagged as root) and 2 (tagged as backup). As you can see below wm (write-mountable) flag was set only for partition 0, whilst the rest have wu (write-unmountable):
- Label the disk and quit the format tool:
- Finally it’s time to grow ZFS rpool and to confirm we’re golden:
# zpool list rpool NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 31.1G 23.6G 7.52G 75% ONLINE -
# prtvtoc /dev/dsk/c4t60060E80167D3C0000017D3C000010CAd0s2
* /dev/dsk/c4t60060E80167D3C0000017D3C000010CAd0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 512 sectors/track
* 15 tracks/cylinder
* 7680 sectors/cylinder
* 8533 cylinders
* 8531 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 65518080 65518079
2 5 01 0 65518080 65518079
# luxadm display /dev/rdsk/c4t60060E80167D3C0000017D3C000010CAd0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c4t60060E80167D3C0000017D3C000010CAd0s2
Vendor: HITACHI
Product ID: OPEN-V -SUN
Revision: 7006
Serial Num: 50 17D3C10CA
Unformatted capacity: 36864.000 MBytes
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0/pci@0/pci@2/scsi@0/sd@0,0
1. c4t60060E80167D3C0000017D3C000010CAd0
/scsi_vhci/ssd@g60060e80167d3c0000017d3c000010ca
Specify disk (enter its number): 1
selecting c4t60060E80167D3C0000017D3C000010CAd0
[disk formatted]
/dev/dsk/c4t60060E80167D3C0000017D3C000010CAd0s0 is part of active ZFS pool rpool. Please see zpool(1M).
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 vendor, product and revision
volname - set 8-character volume name
! - execute , then return
quit
format> type
AVAILABLE DRIVE TYPES:
0. Auto configure
1. Quantum ProDrive 80S
2. Quantum ProDrive 105S
3. CDC Wren IV 94171-344
4. SUN0104
5. SUN0207
6. SUN0327
7. SUN0340
8. SUN0424
9. SUN0535
10. SUN0669
11. SUN1.0G
12. SUN1.05
13. SUN1.3G
14. SUN2.1G
15. SUN2.9G
16. Zip 100
17. Zip 250
18. Peerless 10GB
19. HITACHI-OPEN-V-SUN-7005
20. SUN300G
21. other
Specify disk type (enter its number)[19]: 0
c4t60060E80167D3C0000017D3C000010CAd0: configured with capacity of 35.99GB
selecting c4t60060E80167D3C0000017D3C000010CAd0
[disk formatted]
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
7 - change `7' partition
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
quit
partition>
partition> print Current partition table (unnamed): Total disk cylinders available: 9828 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 9827 35.99GB (9828/0/0) 75479040 1 unassigned wu 0 0 (0/0/0) 0 2 backup wu 0 - 9827 35.99GB (9828/0/0) 75479040 3 unassigned wu 0 0 (0/0/0) 0 4 unassigned wu 0 0 (0/0/0) 0 5 unassigned wu 0 0 (0/0/0) 0 6 unassigned wu 0 0 (0/0/0) 0 7 unassigned wu 0 0 (0/0/0) 0
partition> label
Ready to label disk, continue? yes
partition> q
format> q
# zpool online -e rpool /dev/dsk/c4t60060E80167D3C0000017D3C000010CAd0s0 # zpool list rpool NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 35.9G 23.6G 12.3G 65% ONLINE -
Good luck and safe expanding your pools.
