How to create metadevice and add swap on Oracle Solaris


The following post describes how to add or create swap device in a UFS for SVM environment. Follow these steps when you need to add more swap devices.

Step 1: Format Disks

Add new disks to system and create tables like this.

#format /dev/rdsk/c4t0d0s2
Part Tag Flag Cylinders Size Blocks
0 root wm 0 – 14034 68.10GB (14035/0/0) 142820160
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 – 14086 68.35GB (14087/0/0) 143349312
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 14035 – 14086 258.38MB (52/0/0) 529152
#format /dev/rdsk/c4t1d0s2
Part Tag Flag Cylinders Size Blocks
0 root wm 0 – 14034 68.10GB (14035/0/0) 142820160
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 – 14086 68.35GB (14087/0/0) 143349312
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 14035 – 14086 258.38MB (52/0/0) 529152

Step 2:Create metadevice.

First check if there is no metadevice which named d300 or another name which you ‘ll define.
 

#metastat -a d300
No such file or directory
#metainit d301 1 1 /dev/rdsk/c4t0d0s0 ((create Submirror))
d301: Concat/Stripe is setup
#metainit d300 -m d301 ((Create Mirror))
d300: Mirror is setup
#metainit d302 1 1 /dev/rdsk/c4t1d0s0 ((Attach New Submirror))
d302: Concat/Stripe is setup
#metattach d300 d302
d300: submirror d302 is attached


Step 3:Add new Swap device

#swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d3 85,3 16 77795504 77146480
#swap -a /dev/md/dsk/d300
#swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d3 85,3 16 77795504 77146496
/dev/md/dsk/d300 85,300 16 142820144 142820144


Step 4. Don’t forget to add this configuration on /etc/vfstab

#vi /etc/vfstab
/dev/md/dsk/d300 – – swap – no –

 

Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me

Related Post