Articles
Lets say I have SAN storage, and I have created a 70GB LUN and exposed it to Solaris, where it shows up as ‘c0t3d0′.
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t2d0
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@2,0
1. c0t3d0
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@3,0
Specify disk (enter its number):
Under Solaris, I have created a Zpool named ‘zdata’ using this LUN.
# zpool status
pool: zdata
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
zdata ONLINE 0 0 0
c0t3d0 ONLINE 0 0 0
errors: No known data errors
Over time, I have completely used up the 70GB worth of space, and I need to grow my zpool.
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zdata 66.9G 0 25.5K /export/zdata
zdata/centos 24.5K 0 24.5K legacy
zdata/share 66.9G 0 66.9G /export/zdata/share
Question: How do I do this without corrupting data?
Answer: If you are using the whole lun as your vdev in zpool and using EFI label, you can export zpool, relabel the luns (using the new capacity) and import that zpool. You should be able to see the increased size then.
Assuming that I have given the entire LUN to the zpool (and not a slice), then this procedure should work. That said, I would back up my data if possible just to be on the safe side:
Summary:
- # zpool export zdata
- # format
- choose c0t3d0
- autoconfigure
- partition
- modify
- all-free-hog - choose slice 0
- size zero on all other slices
- label
- quit
- # zpool import mypool
- # zpool status (check for errors)
- # zfs list (should reflect new size)
Actual:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t2d0
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@2,0
1. c0t3d0
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@3,0
Specify disk (enter its number): 1
selecting c0t3d0
[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
fdisk - run the fdisk program
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
c0t3d0: configured with capacity of 68.37GB
selecting c0t3d0
[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
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> modify
Select partitioning base:
0. Current partition table (default)
1. All Free Hog
Choose base (enter number) [0]? 1
Part Tag Flag First Sector Size Last Sector
0 root wm 0 0 0
1 swap wu 0 0 0
2 unassigned wu 0 0 0
3 unassigned wm 0 0 0
4 unassigned wm 0 0 0
5 unassigned wm 0 0 0
6 usr wm 0 0 0
8 reserved wu 0 0 0
Do you wish to continue creating a new partition
table based on above table[yes]? yes
Free Hog partition[6]? 0
Enter size of partition 1 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 2 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 3 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 4 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 5 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 6 [0b, 33e, 0mb, 0gb, 0tb]: 0
Enter size of partition 7 [0b, 33e, 0mb, 0gb, 0tb]: 0
Part Tag Flag First Sector Size Last Sector
0 usr wm 34 68.36GB 143358318
1 unassigned wu 0 0 0
2 unassigned wu 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 wu 143358319 8.00MB 143374702
Ready to label disk, continue? yes
partition> quit
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
fdisk - run the fdisk program
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> quit
Now I can re-import my zpool, and the additional space will be available to my filesystems.
# zpool import zdata
# zpool status
pool: zdata
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
zdata ONLINE 0 0 0
c0t3d0 ONLINE 0 0 0
errors: No known data errors
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zdata 66.9G 0 25.5K /export/zdata
zdata/centos 24.5K 0 24.5K legacy
zdata/share 66.9G 0 66.9G /export/zdata/share
If I had actually grown the underlying LUN, the additional space would have shown up here, and my existing data would be intact.
By the way, OpenSolaris now has the ability to detect and use space that is dynamically allocated to a LUN. This will eventually make its way into production Solaris.
