Friday, 20 May 2011

Back up of a File System in mounted state: snapshot


Back up of a File System in mounted state:
task:
-if suppose my boss said, it should be mounted only  /jumbo and i want back up & don't want any updates.
ans: fssnap                    // snap shot
- user can't accessible until snap shot.

Back up of a File System in mounted state:
- To take a backup of a File System in mounted state the option used is 'snap shot'
- while taking a 'snap shot' all the users will face a 'pause mode'. i.e they can view the File System, but they can't update the data to the File System.
- To create a File System, Format it, mount it & write the data into the mount point.

# Format                // take slice s6, 100m size
# newfs /dev/rdsk/c0t0d0s6
# mkdir /joy
# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# touch j1 j2 j3 j4 j5
# ls
# df -h
  s6   (mounted state)

To create a snap shot:
# fssnap -F ufs -o bs=/var/tmp  /joy           // F- file

/dev/fssnap/0 : snap shot is a image of slice only ( it's not a backup, it is only a image, whatever file in s6 that will be in snap shot)

to verify a snapshot:
# mkdir /toy
# mount -F ufs -o -ro /dev/fssnap/0 /toy
# df -h
/s6   -   /joy
/dev/fssnap/0  -  /toy
# cd /joy
# ls
# cd /toy
# ls

//both have same data in joy & toy, so successfully taken of snap shot

to take a backup of a snapshot:
#  umount /toy

backup:
# ufsdump 0uf /dev/rmt/0 /dev/fssnap/0

till now 3 copies done
1. s6
2. /dev/fssnap/0
3. /dev/rmt/0

verify:
# cat /etc/dumpdates

to verify the backup & recover:
# fssnap -i
0  /joy

to date the snapshot:
# fssnap -d /joy
// deleted snapshot 0

# fssnap -i
//no snap shots

# umount /joy
# newfs /dev/rdsk/c0t0d0s6
// data lost

# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# ls
// nothing, bcoz its formated

to recover the data:
# ufsrestore rvf /dev/rmt/0

check:
# df -h
# cd /joy
# ls
(yes, all recovered)

Note: when we recover the data by using 'ufsrestore' bydefault we are setting one directory 

No comments:

Post a Comment