Don't reboot to add swap on solaris.

Today I wish I had blogged this earlier after the second person who should have known better suggested that you need to reboot a system to increase the swap space when using ZFS for swap. The second one asserted it in such a way that the system I was using was rebooted!

Just like when we did not use zvols for swap you always had the option to have multiple swap devices that option is still there if you are using zvols. You can have multiple zvols just create them and add them to the vfstab so that when you do reboot you still have them. If however you don't like that you can always remove the existing swap device and add a new one of the new size.

Or if you really only want one swap volume and don't want to edit /etc/vfstab and like to live a little bit on the edge you can grow the swap device and then add the extra space as a new swap volume.

cjg@brompton:~$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 182,1 8 4126712 4111472
cjg@brompton:~$ pfexec zfs set volsize=4G rpool/swap
cjg@brompton:~$ pfexec zfs set reservation=4G rpool/swap
cjg@brompton:~$ pfexec env NOINUSE_CHECK=1 swap -a /dev/zvol/dsk/rpool/swap $((8+4126712))
cjg@brompton:~$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 182,1 8 4126712 4111472
/dev/zvol/dsk/rpool/swap 182,1 4126720 4261888 4261888
cjg@brompton:~$

When the system is finally rebooted it will end up with just a single swap device again.

Obviously the correct answer is that the operating system should just “do the right thing” and to that end I have filed this RFE: 6783886The bug should turn up on opensolaris.org in the next few days/hours.

Comments:

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today