Video Screencast Help

Resize swap solaris

Created: 20 Jun 2011 • Updated: 23 Jun 2011 | 6 comments
This issue has been solved. See solution.

OS Solaris 10.

VxVM 5.0MP3.

The question is can i resize swap volume without stopping applications?

Does this operation impact application?

Do i have to reboot my OS?

Discussion Filed Under:

Comments 6 CommentsJump to latest comment

Marianne's picture

Swap on Solaris is normally on partition/slice1. Partitions cannot be resized without affecting adjacent partitions.

You can add a swap file to existing swap and add an entry to vfstab.

This is essentially an OS task, not Storage Foundation...

Maybe you can tell us more about your specific environment?

Is your swap partition on the boot disk or a separate volume?

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links

ExArmic's picture

I have swap volume (swapvol) created in rootdg.

vxassist -g rootdg maxgrow swapvol rootdg02 rootmirror
Volume swapvol can be extended by 48121856 to: 81683456 (39884Mb+1024 sectors)

rootdg02 and rootmirror are disks of rootdg.

The vxassist show that i have space to grow my swapvol, but:

".You cannot grow or shrink any volume associated with an encapsulated root disk. Because these map to a physical underlying partition on the disk and must be contiguous. If you try to grow the system could become unbootable if you need to revert back to booting from slices... "

After that i decide to creat secondary swapvol and add it with "swap -a  /path/to/secondary_swapvol".

I suggest two ways to make secondary swap and i need advice to chose one of them

1. As far as i have free space in rootdg then:

vxassist -g rootdg -U swap make swapvol2

2. Make swap in non rootdg

vxassist -g MYDG -U swap make swapvol2

Plase advice me the best way to do secondary swap.

Do i have to use "-U swap" option in each way.

Marianne's picture

Correct, you need to specify '-U swap' when creating the volume.

After adding it with 'swap -a', you now need to add the swapvol to /etc/vfstab to make it persistent:

/path/to/secondary_swapvol - - swap - no  -

See this TN:

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links

ExArmic's picture

Thanks to your advice.

I have created secondary swap in non-rootdg and have added it to swap.

But I am intersting in can i create secondary swap on rootdg. Can it lead to disk partitions also need to be reconfigured??

# vxdisk list | grep rootdg02                            
disk0 auto:sliced     rootdg02     rootdg       online
# vxdisk list disk0 | grep state | tail -1
c1t50022E8003344955d0s2 state=enabled
# prtvtoc /dev/dsk/c1t50022E8003344955d0s2             
* /dev/dsk/c1t50060E80056DB904d0s2 partition map
* Dimensions:
*     512 bytes/sector
*     512 sectors/track
*      15 tracks/cylinder
*    7680 sectors/cylinder
*   19934 cylinders
*   19932 accessible cylinders
* Flags:
*   1: unmountable
*  10: read-only
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0  33561600  33561599
       1      3    01   33561600  33561600  67123199
       2      5    00          0 153077760 153077759
       3     14    01          0 153077760 153077759
       4     15    01  153008640     69120 153077759
       5      7    00   67123200  16780800  83903999
       6      8    00   83904000  20974080 104878079

and from format utility

partition> p
Current partition table (original):
Total disk cylinders available: 19932 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root      wm       0 -  4369       16.00GB    (4370/0/0)   33561600
  1       swap    wu    4370 -  8739       16.00GB    (4370/0/0)   33561600
  2     backup   wm       0 - 19931       72.99GB    (19932/0/0) 153077760
  3          -        wu       0 - 19931       72.99GB    (19932/0/0) 153077760
  4          -        wu   19923 - 19931       33.75MB    (9/0/0)         69120
  5        var       wm    8740 - 10924        8.00GB    (2185/0/0)   16780800
  6       home    wm   10925 - 13655       10.00GB    (2731/0/0)   20974080
  7 unassigned  wm       0                0         (0/0/0)             0

As you can see disk have free space.

Marianne's picture

You can create a swapvol on a spare disk in rootdg and add it with 'swap -a' plus vfstab entry in the same way that you added the non-rootdg volume.

The only thing that you cannot do is to resize the original swap partition (slice 1) on the boot disk.

The TN that I've posted above describes the steps in detail. Please take note of the bootdg usage requirement when using the new swapvol in rootdg.

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links