Tagged in , , and posted in Disksuite (SDS), Solaris

Procedure to Re-layout the Solaris OS Disk

Note: Before proceeding with this procedure is very IMPORTANT that you follow the following pre-requisites.

a) Capture the current partition table layout of the OS prior to the re-layout

Part  Tag         Flag  Cylinders   Size        Blocks
0     root        wm    0 –  2177   3.00GB      (2178/0/0) 6292242
1     swap        wu    2178 – 3629 2.00GB      (1452/0/0) 4194828
2     backup      wu    0 – 24619   33.92GB     (24620/0/0) 71127180
3     unassigned  wm    3630 – 3644 21.16MB     (15/0/0)    43335
4     unassigned  wm    3645 – 3659 21.16MB     (15/0/0)    43335
5     unassigned  wm    3660 – 5837 3.00GB      (2178/0/0)  6292242
6     unassigned  wm    5838 – 6563 1.00GB      (726/0/0)   2097414
7     unassigned  wm    6564 – 2461924.87GB     (18056/0/0) 52163784

b) What is the NEW layout we want to have?

Part        Tag         Size

0         root        8.00GB
1         swap        8.00GB
2         backup      33.92GB     <– This is the size of the disk
3         unassigned  21.16MB     <– Metareplicas partition
4         unassigned  21.16MB
5         var         4.00GB
6         unassigned  2.00GB      <– /opt/patrol
7         unassigned  11.87GB     <–Unused or is either /export or /local please check

c) Capture current metadevices and take note of the devices for rootdisk and rootmirror:

NOTE: Fix rootdisk/rootmirror aliases if required and set boot-device and boot-diag to point to the correct devices when you bring the OS down or in 3rd Run Level with the eeprom command.

# metastat -p

d1 -m d10 d11 1
d10 1 1 c1t0d0s0           -> /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w2100002037f8b445,0
d11 1 1 c4t0d0s0
d2 -m d20 d21 1
d20 1 1 c1t0d0s5
d21 1 1 c4t0d0s5          -> /pci@8,700000/pci@3/scsi@4/sd@0,0
d3 -m d30 d31 1
d30 1 1 c1t0d0s1
d31 1 1 c4t0d0s1
d4 -m d40 d41 1
d40 1 1 c1t0d0s6
d41 1 1 c4t0d0s6
d5 -m d50 d51 1
d50 1 1 c1t1d0s0
d51 1 1 c4t1d0s0

boot-device=/pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w21000004cfe4d746,0:a disk net

nvramrc=devalias rootmirror /pci@8,700000/pci@3/scsi@4/sd@0,0

d) Capture swap information as follows:

# grep swap /etc/vfstab | grep md

/dev/md/dsk/d3  –       –       swap    –       no      –

/dev/md/dsk/d5  –       –       swap    –       no      –

NOTE: Will eliminate d5, d50 and d51 because d3 will be increased to 8GB

# swap -l

swapfile             dev  swaplo blocks   free

/dev/md/dsk/d3      85,3      16 4194800  4194448

/dev/md/dsk/d5      85,5      16 12584464 12584112

e) Backup the following files to /var/tmp

/etc/system

/etc/vfstab

metastat -p

metadb

vtoc of rootdisk

cp /etc/vfstab /var/tmp/vfstab.orig

cp /etc/system /var/tmp/system.orig

metastat -p >> /var/tmp/metastat-p.orig

metadb >> /var/tmp/metadb.orig

prtvtoc /dev/rdsk/c1t0d0s2 >> /var/tmp/prtvtoc.orig

Procedure:

1.- Detach the rootdisk side

metadetach d1 d10; metadetach d2 d20; metadetach d3 d30

metadetach d4 d40; metadetach d5 d50

2.- Verify the rootdisk is detached

metastat -p

d1 -m d11 1
d11 1 1 c4t0d0s0
d2 -m d21 1
d21 1 1 c4t0d0s5
d3 -m d31 1
d31 1 1 c4t0d0s1
d4 -m d41 1
d41 1 1 c4t0d0s6
d5 -m d51 1
d51 1 1 c4t1d0s0
d10 1 1 c1t0d0s0
d20 1 1 c1t0d0s5
d30 1 1 c1t0d0s1
d40 1 1 c1t0d0s6
d50 1 1 c1t1d0s0

3.- Clear the rootdisk metadevices and metareplicas

metadb -d c1t0d0s3

metaclear d10 d20 d30 d40 d50

d10: Concat/Stripe is cleared

d20: Concat/Stripe is cleared

d30: Concat/Stripe is cleared

d40: Concat/Stripe is cleared

d50: Concat/Stripe is cleared

4.- Re-layout the rootdisk OS disk as wanted MAKING sure the new slices are the same or grater than they are currently set AND make sure it doesn’t overlap any cylinder. Then label it.

format -> partition -> label -> quit

Part      Tag       Flag    Size

0       root        wm       8.00GB

1       swap      wu        8.00GB

2     backup     wu        33.92GB

3 unassigned   wm       21.16MB

4 unassigned   wm       21.16MB

5        var        wm       4.00GB

6 unassigned   wm       2.00GB

7 unassigned   wm       11.87GB

5.- Recreate the deleted metadevices and metareplicas (Do not recreate d50)

metadb -a -c 3 c1t0d0s3

metainit d10 1 1 c1t0d0s0

metainit d20 1 1 c1t0d0s5

metainit d30 1 1 c1t0d0s1

metainit d40 1 1 c1t0d0s6

6.- Attach the rootdisk metadevices and wait for the sync to finish

(verify with metastat | grep -i resync)

metattach d1 d10; metattach d2 d20; metattach d3 d30; metattach d4 d40

metastat | grep -i resync

7.- Edit vfstab to point to the new extended metadevices except root and delete d5 (2nd swap).

vi /etc/vfstab

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      –       /dev/fd fd      –       no      –
/proc   –       /proc   proc    –       no      –
/dev/md/dsk/d30  –       –       swap    –       no      –
/dev/md/dsk/d1  /dev/md/rdsk/d1 /       ufs     1       no      logging
/dev/md/dsk/d20  /dev/md/rdsk/d20 /var    ufs     1       no      logging
/dev/md/dsk/d40  /dev/md/rdsk/d40 /opt/patrol     ufs     2       yes     logging     swap    –       /tmp    tmpfs   –       yes     –
/dev/vx/dsk/emcdatadg/local_app         /dev/vx/rdsk/emcdatadg/local_app            /local/app      vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/oracle_app        /dev/vx/rdsk/emcdatadg/oracle_app        /oracle/app     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/oracle_dba        /dev/vx/rdsk/emcdatadg/oracle_dba       /oracle/dba     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/oracle_exp        /dev/vx/rdsk/emcdatadg/oracle_exp       /oracle/exports vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/u01       /dev/vx/rdsk/emcdatadg/u01      /oracle/u01     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/u02       /dev/vx/rdsk/emcdatadg/u02      /oracle/u02     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/u03       /dev/vx/rdsk/emcdatadg/u03      /oracle/u03     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/archive   /dev/vx/rdsk/emcdatadg/archive  /oracle/archive vxfs    2       yes     –

Verify with:        cat /etc/vfstab

8.- Edit the /etc/system to prevent disksuite to start with

metaroot c1t0d0s0

Verify vfstab and system files:

cat /etc/system

cat /etc/vfstab

9.- Once the sync is done metadetach again the rootdisk disk but take special attention to the swap partition and then delete the c4t0d0s3 metareplicas.

metadetach d1 d10;metadetach d2 d20;metadetach d3 d30

metadetach d4 d40;metadb -d /dev/dsk/c4t0d0s3

Note: Steps 9 to 12 needs to be done on the same day to have a consistent up to date OS disk.

 

10.- Verify the rootdisk is detached and replicas deleted

metastat -p; metadb

metastat -p

d1 -m d11 1

d11 1 1 c4t0d0s0

d2 -m d21 1

d21 1 1 c4t0d0s5

d3 -m d31 1

d31 1 1 c4t0d0s1

d4 -m d41 1

d41 1 1 c4t0d0s6

d5 -m d51 1

d51 1 1 c4t1d0s0

d10 1 1 c1t0d0s0

d20 1 1 c1t0d0s5

d30 1 1 c1t0d0s1

d40 1 1 c1t0d0s6

11.- Now fsck every extended filesystem, mount it to /mnt and expand it.

a.         For root

fsck /dev/md/rdsk/d10

mount /dev/md/dsk/d10 /mnt

df -k /mnt

growfs -M /mnt /dev/md/rdsk/d10

df -k /mnt

umount /mnt

b.         For /var

fsck /dev/md/rdsk/d20

mount /dev/md/dsk/d20 /mnt

df -k /mnt

growfs -M /mnt /dev/md/rdsk/d20

df -k /mnt

umount /mnt

c.         For /opt/patrol

fsck /dev/md/rdsk/d40

mount /dev/md/dsk/d40 /mnt

df -k /mnt

growfs -M /mnt /dev/md/rdsk/d40

df -k /mnt

umount /mnt

12.- Bring down the server and boot it in single user mode to check it starts from the expanded OS disk

shutdown -y -g0 -i0

boot rootdisk -s

df -k

metastat -p; metadb

swap –l

dumpadm

13.- Clear all rootmirror and mirror metadevices

metaclear d1 d2 d3 d4 d5 d11 d21 d31 d41 d51

metastat -p

14.- Partiton the rootmirror disk as the rootdisk

prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s – /dev/rdsk/c4t0d0s2

15.- Add again the deleted replicas

metadb -a -c 3 c4t0d0s3; metadb

16.- Recreate the mirror again.

metainit d11 1 1 c4t0d0s0;metainit d21 1 1 c4t0d0s5;metainit d31 1 1 c4t0d0s1

metainit d41 1 1 c4t0d0s6

metainit d1 -m d10;metainit -f d2 -m d20

metainit -f d3 -m d30; metainit -f d4 -m d40

metastat -p

metaroot d1

17.- Edit the /etc/vfstab to point to all mirror metadevices

NOTE: Make sure d5 is no longer in the vfstab

vi /etc/vfstab

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      –       /dev/fd fd      –       no      –
/proc   –       /proc   proc    –       no      –
/dev/md/dsk/d3  –       –       swap    –       no      –
/dev/md/dsk/d1  /dev/md/rdsk/d1 /       ufs     1       no      logging
/dev/md/dsk/d2  /dev/md/rdsk/d2 /var    ufs     1       no      logging
/dev/md/dsk/d4  /dev/md/rdsk/d4 /opt/patrol     ufs     2       yes     logging            swap    –       /tmp    tmpfs   –       yes     –
/dev/vx/dsk/emcdatadg/local_app         /dev/vx/rdsk/emcdatadg/local_app        /local/app      vxfs    2                yes     –
/dev/vx/dsk/emcdatadg/oracle_app        /dev/vx/rdsk/emcdatadg/oracle_app       /oracle/app     vxfs    2          yes     –
/dev/vx/dsk/emcdatadg/oracle_dba        /dev/vx/rdsk/emcdatadg/oracle_dba       /oracle/dba     vxfs    2          yes     –
/dev/vx/dsk/emcdatadg/oracle_exp        /dev/vx/rdsk/emcdatadg/oracle_exp       /oracle/exports vxfs    2      yes     –
/dev/vx/dsk/emcdatadg/u01       /dev/vx/rdsk/emcdatadg/u01      /oracle/u01     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/u02       /dev/vx/rdsk/emcdatadg/u02      /oracle/u02     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/u03       /dev/vx/rdsk/emcdatadg/u03      /oracle/u03     vxfs    2       yes     –
/dev/vx/dsk/emcdatadg/archive   /dev/vx/rdsk/emcdatadg/archive  /oracle/archive vxfs    2       yes     –

Verify with: cat /etc/vfstab

18.- Bring down the server and boot it to level 3 but going to single user mode first, once it is verified that the filesystems are being mounted to mirror metadevices and that SWAP (d3) is grown to the new size (8GB on this case), bring it to level 3.

init 0

boot rootdisk -s

swap -l

dumpadm

df -k

exit                   <– server continues to boot to level 3

df -k

metadb

metastat -p

19.- Attach the detached metadevices to synch the mirror

metattach d1 d11; metattach d2 d21; metattach d3 d31; metattach d4 d41

metastat -p

20.- Verify the sych status

metastat | grep -i resync

%d bloggers like this: