Expanding a zpool online
Here is the situation: A Solaris 10 server need lots of zfs based disk storage. The sysadmin cuts a LUN, presents it to the server, creates a zpool and zfs filesystem and then mounts the filesystem. A few months later, free storage space on that file system is running out. Soon more disk space will be needed. The sysadmin knows he can expand underlying LUN but can he expand the zpool on the LUN without downtime? The answer is yes. See http://download.oracle.com/docs/cd/E19082-01/817-2271/githb/index.html Here is an example of expanding zfs filesystem without taking it offline. The zpool to be expanded here is "testpool".
root@bkup01 # zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 278G 25.4G 253G 9% ONLINE - testpool 484M 95.5K 484M 0% ONLINE - <---- original size 500MThis is a 500M zpool lying on a 500M LUN. The LUN is then expanded to 1G. The first step to expand the zpool is to use "format" to resize the slice on the LUN. This is disk 2 in the output below:
AVAILABLE DISK SELECTIONS:
0. c0t5000C5003327ADCBd0
/scsi_vhci/disk@g5000c5003327adcb
1. c0t5000C5003327F96Fd0
/scsi_vhci/disk@g5000c5003327f96f
2. c0t600144F0B225EF1D00004E6DC0720005d0
/scsi_vhci/ssd@g600144f0b225ef1d00004e6dc0720005
Specify disk (enter its number): 2
selecting c0t600144F0B225EF1D00004E6DC0720005d0
[disk formatted]
/dev/dsk/c0t600144F0B225EF1D00004E6DC0720005d0s0 is part of active ZFS pool testpool. 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
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. other
Specify disk type (enter its number)[1]: 0
c0t600144F0B225EF1D00004E6DC0720005d0: configured with capacity of 1024.00MB
selecting c0t600144F0B225EF1D00004E6DC0720005d0
[disk formatted]
/dev/dsk/c0t600144F0B225EF1D00004E6DC0720005d0s0 is part of active ZFS pool testpool. Please see zpool(1M).
format> p
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
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
! - execute , then return
quit
partition> 0
Part Tag Flag First Sector Size Last Sector
0 usr wm 34 1015.97MB 2080734
Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting Sector[34]: 256 <--- make sure you get the start sector right. The original starting sector was 256.
Enter partition size[2078720b, 2078975e, 1015mb, 0gb, 0tb]: 1015mb <--- this is the new size of the slice.
partition> l
Ready to label disk, continue? y
partition> quit
Note: when resizing the disk slice with zpool but sure to keep the starting sector number at the original value. If you manage to change the starting sector to some value before the original value, you'll destroy the zpool! The ZFS implementation in my version of Solaris (version 10 9/10) was smart enough to stop me from doing that but it's better to be safe than sorry and get it right the first time. The disk slice has been expanded. Now to expand the zpool:
root@bkup01 # zpool online -e testpool c0t600144F0B225EF1D00004E6D9C3D0004d0 <--- the key command. root@bkup01 # zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 278G 25.4G 253G 9% ONLINE - testpool 1008M 95.5K 1008M 0% ONLINE - <----- New sizeAnd that's it.