Saturday, January 16, 2016

Filesystem Migration with zfs incremental snapshot





Filesystem Migration with zfs snapshot
1) Create new ZFS file system on storage pool(USDpool,SDMpool, PRPpool) with in the zones(nlxusd01sdm,nlxusd01usd,nlxusd01prp).
     #zfs create -o mountpoint=/usd_new SDMpool/SDM/usd
     #zfs create -o mountpoint=/usd_fs_new SDMpool/SDM/usd_fs

2) See whether new filesystems created and mounted.
    #zfs list
   #zfs mount SDMpool/SDM/usd_fs
   #zfs mount SDMpool/SDM/usd

3)set quota to usd_fs_new and usd_new which should be same as usd_fs and usd filesystems. Once quota is set see whether file system are set with quotas.
       #zfs set quota=12gb SDMpool/SDM/usd
      #zfs set quota=5gb SDMpool/SDM/usd_fs

4) Create a snapshot of current rpool/SDM/usd(usd filesystem) and rpool/SDM/usd_fs(usd_fs filesystem).Once snapshots are created check whether snapshots are created are not with zfs command.
      #zfs snapshot rpool/SDM/usd@snap1
      #zfs snapshot rpool/SDM/usd_fs@snap1
      #zfs list –t snapshot

5) send snapshots to newly created file systems SDMpool/SDM/usd(usd_new) and SDMpool/SDM/usd_fs(usd_fs_new)
         #zfs send rpool/SDM/usd@snap1 |zfs receive -F             SDMpool/SDM/usd
       #zfs send rpool/SDM/usd_fs@snap1|zfs receive -F    SDMpool/SDM/usd_fs

After application and esb  is stopped
   6.a) Rename /usr/local/sbin/scponlyc file
       #mv /usr/local/sbin/scponlyc /usr/local/sbin/scponlyc.disbaled
    6.b)Check the esb in & out process and if found kill the     process(sshd/sftp)
          Check whether Generic Interface is stopped and it is in not   running state
         #nlxusd01sdm:root>usdadm g s
        Report USDGenericIF monitoring [g]
         java -jar USDGenericIF.jar  UNMANAGED   not  running
Check for the process and kill the process
           # ps -ef | egrep "\-in|-out"
           #ps -ef | egrep "\-in|-out"|wc –l
           #ps -ef | egrep "\-in|-out" | awk '{ print $2 }' | xargs kill
           # ps -ef | egrep "\-in|-out"

6.c)Hash out crontab on nlxusdm and see if any usd_rsync process runs.
#* * * * * /u/root/scripts/sysman/scripts/usd_rsync

6.d)Take a new snapshot once application is stopped
       #zfs snapshot rpool/SDM/usd@snap2
      #zfs snapshot rpool/SDM/usd_fs@snap2

7) You can now do an incremental send of the difference between the     two snapshots. But before we do send and receive see that no rsync and no sftp interface process should run and if found kill the rsync and sftp process.
#zfs send -i rpool/SDM/usd@snap1\
       rpool/SDM/usd@snap2 | zfs receive SDMpool/SDM/usd
       #zfs send -i rpool/SDM/usd_fs@snap1\
       rpool/SDM/usd_fs@snap2 | zfs receive SDMpool/SDM/usd

7.b)Run usd-rsync script manually on server nlxusd02sdm and wait until rysnc completes
             #/u/root/scripts/sysman/scripts/usd_rsync
                Ps –ef |grep –I  usd_rsync

8) Umount file systems /usd and /usd_fs and /usd_new and /usd_fs_new. Before umounting see no rsync and sftp interface process should run and if found kill the process.
           # umount /usd/attachments
           #umount /usd
           #umount /usd_fs

9) Now set the file system mount point from the old dataset to the new one
          #zfs set mountpoint=/usd.old  rpool/SDM/usd
          #zfs set mountpoint=/usd  SDMpool/SDM/usd
          #zfs set mountpoint=/usd_fs.old  rpool/SDM/usd_fs
         #zfs set mountpoint=/usd_fs  SDMpool/USD/usd_fs

10)Now Mount the file systems 
       #zfs mount -O SDMpool/SDM/usd
       #zfs mount -O SDMpool/SDM/usd_fs
       #zfs mount -O rpool/SDM/usd
       #zfs mount -O rpool/SDM/usd_fs
####zfs mount -O SDMpool/SDM/attachments do not mount until we make tests

11.a)Now check whether data is copied with any difference. ACl, links and permissions were reverted
       #Cd /usd
       # ls -lRa .>/tmp/s1
       #cd /usd.old
       #ls -lRa . > /tmp/s2
       #sdiff /tmp/ls[12] | egrep -v "^d|^l" | egrep "\||<|>"  | more

      check the file count which should be the same

      #ls -l /tmp/s[12]
      # wc -l /tmp/s[12]

      # ls -ld /usd
      #ls -ld /usd_fs
      #ls –Vd /usd
      #ls –Vd /usd_fs
11.b)If found no difference and data is same mount attachments
          zfs mount -O SDMpool/SDM/attachments
12)Once activity is done(mv /usr/local/sbin/scponlyc.disabled /usr/local/sbin/scponlyc) and start application  revert the cron changes

No comments:

Post a Comment