Friday, May 22, 2009

Backup and copy boot/system disk into another disk.... flarcreate

Solaris Operating System have many utilities or commands for backup and copy bootdisk. We can use paired ufsdump-ufsrestose, fssnap, dd, flarcreate, and so on. Following is a list of steps when we copy bootdisk using flarcreate. The purpose of this step is making a server bootdisk archive's file (flash archive). It is useful when we do rolling server upgrade and/or rolling server migration into another datacenter site. By restoring the flash archive into another server, we then have a cloning server.

Preparation:
- Create exclude file. A file containing list of filesystem which will excluded during archiving.
- File house keeping. Delete or move (backup) un-necessary files (eg; coredump, log files, messages, etc)
- Run explorer to capture the latest system configuration.

root@sun1: # df -k
Filesystem kbytes used avail capacity Mounted on
/dev/md/dsk/d10 33053541 3731851 28991155 12% /
/proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
fd 0 0 0 0% /dev/fd
swap 33409688 168 33409520 1% /var/run
swap 33409992 472 33409520 1% /tmp
/dev/md/dsk/d40 35308580 37056 34918439 1% /oracle
/dev/md/dsk/d30 25206312 2474452 22479797 10% /export/home
/dev/md/dsk/d51 10325804 5117813 5104733 51% /app/rdbms
/dev/md/dsk/d54 986359 13409 913769 2% /ora/control
/dev/md/dsk/d57 986359 103513 823665 12% /ora/redo
/dev/md/dsk/d58 206531907 154964219 49502369 76% /ora/data1
/dev/md/dsk/d59 206531907 194515035 9951553 96% /ora/data2
/dev/md/dsk/d63 206531907 10320826 194145762 6% /ora/index
/dev/md/dsk/d64 77449353 782820 75892040 2% /ora/archieve

root@sun1: # cat /tmp/exclude_file
/ora/control
/ora/redo
/ora/data1
/ora/data2
/ora/index
/ora/archive

Execute flarcreate command with following options;
flarcreate -n "Clone_system" -c -X /fs_exclude_file -R / /fs_desination/archive_file_name
Note:
-n: name of archived / image
-c: compress
-I: ignore integrity check
-R: the image start from /
-S: skip the disk space check
-X: flag for exclude
/fs_exclude_file: a file containing list of filesystem to be excluded from archive
/fs_destination/archive_file_name: flash (archive) file

root@sun1: # flarcreate -n "Clone_sun1" -c -X /exclude_file -R / /ora/index/sun1-flar-2009
Full Flash
Checking integrity...
Integrity OK.
Running precreation scripts...
Precreation scripts done.
Determining the size of the archive...
cpio: "var/tmp/.oracle/s#28286.1" ?
cpio: "var/tmp/.oracle/s#14887.1" ?
cpio: "var/tmp/.oracle/s#3727.1" ?
cpio: "var/tmp/.oracle/s#3742.1" ?
cpio: "var/tmp/.oracle/sDBPROC" ?
11558133 blocks
5 error(s)
The archive will be approximately 5.91GB.
Creating the archive...
cpio: "var/tmp/.oracle/s#28286.1" ?
cpio: "var/tmp/.oracle/s#14887.1" ?
cpio: "var/tmp/.oracle/s#3727.1" ?
cpio: "var/tmp/.oracle/s#3742.1" ?
cpio: "var/tmp/.oracle/sDBPROC" ?
11558133 blocks
5 error(s)
Archive creation complete.
(Note: the errors can be ignored)

File integrity and disk space check will take a longer times, if necessary these check can be omitted by execute command with the following option:
root@sun1: # flarcreate -n "Clone_sun1" -c -S -I -X /exclude_file -R / /ora/index/sun1-flar-2009
Full Flash
No integrity check. Option "-I" set.
Running precreation scripts...
Precreation scripts done.
Creating the archive...
cpio: "var/tmp/.oracle/s#28286.1" ?
cpio: "var/tmp/.oracle/s#14887.1" ?
cpio: "var/tmp/.oracle/s#3727.1" ?
cpio: "var/tmp/.oracle/s#3742.1" ?
cpio: "var/tmp/.oracle/sDBPROC" ?
11558133 blocks
5 error(s)
Archive creation complete.
(Note: the errors can be ignored)

The next step is restoring the flash (archive) file into another server, either by:
1. Install from cdrom by select for Flash install, or
2. Install through Jumpstart Enterprise Toolkit (JET)

Note:
During archive process (flarcreate), /etc/shadow file won't be backup (excluded). As such we need to copy it into new server once the restore process have been done. Otherwise we may need to reset the existing user password manually.


No comments:

Post a Comment