0% found this document useful (0 votes)
63 views35 pages

Advanced Backup Techniques

Uploaded by

Besho1977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views35 pages

Advanced Backup Techniques

Uploaded by

Besho1977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Advanced backup techniques

© Copyright IBM Corporation 2012


Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 7.0
Unit objectives
IBM Power Systems

After completing this unit, you should be able to:


• Explain factors related to online backup consistency
• Use JFS split mirror to back up file system data
• Use a snapshot volume group to backup file system data
• Use JFS2 snapshot to back up file system data
• Explain AIX considerations in using SAN Copy facilities

© Copyright IBM Corporation 2012


Backup data inconsistency
IBM Power Systems

• Applications may have multiple data updates per transaction


• Failure to capture all related updates results in inconsistent
backups
• Application may use transaction logs to re-establish integrity
during recovery
– Otherwise, backup needs to have consistency
Data states

Transaction X0, Y0

Write X1 X1, Y0
backup
X1, Y0
Write Y1 X1, Y1

© Copyright IBM Corporation 2012


Ensuring backup data consistency
IBM Power Systems

• Offline backup: Integrity assured by stopping application and


unmounting the file systems

• Online backup: Integrity assured by quiescing application


processing during backup
– Stops writing data to file system for new transactions
– Completes writes for previously started transactions

• Problem: Time needed to backup is often too long to have


application stopped or quiesced

• Solution: Provide a quick way to capture a stable data state,


thus requiring only a brief quiesce
© Copyright IBM Corporation 2012
Topic 1 objectives
IBM Power Systems

After completing this topic, you should be able to:


• Create a split mirror of a JFS file system
• Backup data from the copy that was split off
• Reintegrate the split copy with the remaining mirror copies

© Copyright IBM Corporation 2012


Online JFS backup
IBM Power Systems

File system: /fs1

Copy 1 Copy 2 Copy 3

jfslog

# lsvg -l newvg
newvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
loglv00 jfslog 1 3 3 open/syncd N/A
lv03 jfs 1 3 3 open/syncd /fs1

© Copyright IBM Corporation 2012


Splitting the mirror
IBM Power Systems

/backup
File system
/fs1

Copy 1 Copy 2 Copy 3

jfslog

# chfs -a splitcopy=/backup -a copy=3 /fs1

© Copyright IBM Corporation 2012


Reintegrate a mirror backup copy
IBM Power Systems

File system /backup


/fs1
syncvg

Copy 1 Copy 2
Copy 3

syncvg
jfslog

# unmount /backup
# rmfs /backup

© Copyright IBM Corporation 2012


Snapshot volume groups (1 of 2)
IBM Power Systems

• All logical volumes must be mirrored on disks that contain


only those mirrors

• Ensure there are no stale copies

• Use the splitvg command to split a mirrored copy into a


snapshot volume group
– Uses the recreatevg command to implement

• The split copy becomes a new volume group, called a


snapshot volume group, with its own VGname

• New logical volumes and mount points are created in the


snapshot volume group

• The snapshot file systems are not automatically mounted


© Copyright IBM Corporation 2012
Snapshot volume groups (2 of 2)
IBM Power Systems

• Physical partition changes in both volume groups are tracked


– Writes to a physical partition in the original volume group causes a
corresponding physical partition in the snapshot volume group to be
marked stale
– Writes to a physical partition in the snapshot volume group causes that
physical partition to be marked stale

• Use the joinvg command to rejoin the volume groups


– The stale physical partitions are resynchronized
– The user will see the same data in the rejoined volume group as was
in the original volume group before the rejoin

© Copyright IBM Corporation 2012


Snapshot volume group commands
IBM Power Systems

splitvg [ -y SnapVGname ] [-c copy] [-f] [-i] Vgname


-y Specifies the name of the snapped volume group
-c Specifies which mirror to use (1, 2 or 3)
-f Forces the split even if there are stale partitions
-i Creates an independent volume group which cannot be rejoined
into the original

joinvg [-f] Vgname


-f Forces the join when disks in the snapshot volume group are
missing or removed

© Copyright IBM Corporation 2012


Snapshot volume group example
IBM Power Systems

Example: File system /data is in the datavg volume group


• These commands split the volume group, create a backup
of the /data file system and then rejoins the snapshot
volume group with the original.

1.splitvg -y snapvg datavg


The volume group datavg is split and the volume group snapvg is
created. The mount point /fs/data is created
2.backup -f /dev/rmt0 /fs/data
An i-node based backup of the unmounted file system /fs/data is
created on tape
3.joinvg datavg
snapvg is rejoined with the original volume group and synced in the
background
© Copyright IBM Corporation 2012
Topic 2 objectives
IBM Power Systems

After completing this topic, you should be able to:


• Create either an internal or external JFS2 snapshot
• List existing JFS2 snapshots
• Recover lost or corrupted files from a JFS2 snapshot
• Remove a JFS2 snapshot
• Increase the size of an external JFS2 snapshot

© Copyright IBM Corporation 2012


JFS2 snapshot (1 of 2)
IBM Power Systems

• A point-in-time image of a JFS2 file system


– Source file system is called the snapped file system (snappedFS)
– Snapshot creation is very quick and requires little space
– It can have multiple snapshots for a single snappedFS, each taken at a
different point in time

• A snapshot image of a JFS2 file system can be used to:


– Restore files from a known point in time
– Access files or directories as they were at the time of the snapshot
– Back up a mounted snapshot to tape, DVD or a remote server

© Copyright IBM Corporation 2012


JFS2 snapshot (2 of 2)
IBM Power Systems

• Snapshot stays stable while snappedFS is changing

• Using snapshot reduces application downtime


– Automatically freezes I/O while snapshot is created
– If intolerant of fuzzy backups, briefly quiesce the application

• A snapshot typically needs 2% - 6% of snappedFS space requirements.


There are two options:
– Separate logical volume (ppsize unit of allocation)
– Allocate space out of snappedFS (called an internal snapshot)

• At snapshot creation, only structure information is included

• When a write or delete occurs in the snappedFS, the affected blocks are
copied into existing snapshots
© Copyright IBM Corporation 2012
JFS2 snapshot mechanism (1 of 2)
IBM Power Systems

snappedFS

inode1 inode2

snapshot

inode1 inode2

Initially, the snapshot only points to data extents in


snappedFS
© Copyright IBM Corporation 2012
JFS2 snapshot mechanism (2 of 2)
IBM Power Systems

snappedFS

inode1 inode2

snapshot

inode1 inode2

Original of modified data copied to snapshot

© Copyright IBM Corporation 2012


JFS2 snapshot SMIT menu
IBM Power Systems

# smit jfs2

Enhanced Journaled File Systems

Move cursor to desired item and press Enter.

. . .
List Snapshots for an Enhanced Journaled File System
Create Snapshot for an Enhanced Journaled File System
Mount Snapshot for an Enhanced Journaled File System
Remove Snapshot for an Enhanced Journaled File System
Unmount Snapshot for an Enhanced Journaled File System
Change Snapshot for an Enhanced Journaled File System
Rollback an Enhanced Journaled File System to a Snapshot

© Copyright IBM Corporation 2012


Creating snapshots: External
IBM Power Systems

# snapshot -o snapfrom=snappedFS -o size=Size


# snapshot -o snapfrom=/home/myfs -o size=16M
-OR-
# smit crsnapj2
Create
Create Snapshot
Snapshot for
for an
an Enhanced
Enhanced Journaled
Journaled File
File System
System
in
in New
New Logical
Logical Volume
Volume

[Entry
[Entry Fields]
Fields]
File
File System
System Name
Name /home/myfs
/home/myfs
SIZE
SIZE of snapshot
of snapshot
Unit
Unit Size
Size Megabytes
Megabytes ++
** Number
Number of
of units
units [500]
[500] ##

• Creating a snapshot as part of the mount option


# mount –o snapto=/dev/mysnaplv /home/myfs
© Copyright IBM Corporation 2012
Creating snapshots: Internal
IBM Power Systems

# snapshot -o snapfrom=snappedFS –n snapshotName


# snapshot -o snapfrom=/home/myfs –n mysnap
-OR-
# smit crintsnapj2

Create
Create Snapshot
Snapshot for
for an
an Enhanced
Enhanced Journaled
Journaled File
File System
System in
in File
File System
System

[Entry
[Entry Fields]
Fields]
File
File System
System Name
Name /home/myfs
/home/myfs
** Snapshot
Snapshot Name
Name [mysnap]
[mysnap]

• Internal snapshot attribute must be set to yes on creation of the file system:

# smitcrfs (in dialog panel: Allow Internal Snapshots [yes])


-OR-
# crfs –a isnapshot=yes
© Copyright IBM Corporation 2012
Listing snapshots
IBM Power Systems

# smit lssnap (and select file system from list)


-OR-
## snapshot
snapshot -q
-q /home/myfs2
/home/myfs2

Snapshots
Snapshots for
for /home/myfs2
/home/myfs2
Current Name
Current Name Time
Time
mysnap
mysnap Wed
Wed 19
19 Nov
Nov 08:44:33
08:44:33 2008
2008
mysnap2
mysnap2 Fri 21 Nov 09:33:33 2008
Fri 21 Nov 09:33:33 2008
** mysnap3
mysnap3 Mon
Mon 24
24 Nov
Nov 14:03:18
14:03:18 2008
2008

## snapshot
snapshot -q
-q /home/myfs
/home/myfs

Snapshots
Snapshots for
for /home/myfs
/home/myfs
Current
Current Location 512-blocks
Location 512-blocks Free
Free Time
Time
** /dev/fslv06
/dev/fslv06 262144
262144 261376
261376 Wed
Wed May
May 66 18:15:11
18:15:11 2009
2009

© Copyright IBM Corporation 2012


Using a JFS2 snapshot to recover
IBM Power Systems

• Recover entire file system to point of snapshot creation:


# umount /home/myfs
# rollback /home/myfs /dev/mysnaplv (for external)
# rollback –n mysnap /home/myfs (for internal)

• Recover individual files from JFS2 snapshot image:


– Mount the snapshot (if external):
# mount -v jfs2 -o snapshot /dev/mysnaplv /mntsnapshot

– Change to the directory that contains the snapshot:


# cd /mntsnapshot
# cd /home/mfs/.snapshot/mysnap (if internal)

– Copy the accurate file to overwrite the corrupted one:


# cp myfile /home/myfs (Copies only the file named myfile)
© Copyright IBM Corporation 2012
Using a JFS2 external snapshot to back up
IBM Power Systems

• The JFS2 snapshot can be a stable source for backup to


media

• Mount the external snapshot and use relative path backup:


# mount -v jfs2 -o snapshot /dev/mysnaplv /mntsnapshot
# cd /mntsnapshot
# find . | backup –i –d /servermnt/backup52

• To create snapshot and backup in one operation:


# backsnap -m MountPoint -s Size BackupOptions snappedFS

For example:
# backsnap -m /mntsnapshot -s size=16M –I –f /dev/rmt0
/home/myfs
© Copyright IBM Corporation 2012
Using a JFS2 internal snapshot to back up
IBM Power Systems

•cd to internal snapshot and use relative path backup:


# cd /home/myfs/.snapshot/mysnap
# find . | backup –i –d /servermnt/backup52

• To create snapshot and backup in one operation:


# backsnap –n snapshotname BackupOptions snappedFS

For example:
# backsnap –n mysnap -s size=16M -i -f/dev/rmt0
/home/myfs

© Copyright IBM Corporation 2012


JFS2 snapshot space management
IBM Power Systems

• List snapshots for the snappedFS


# snapshot –q snappedFS

• External snapshot:
– The snapshot report identifies the size and amount of free space
– If the snapshot needs more space:
# snapshot –o size=+1 snapshotLV

• Internal snapshot:
– Shares logical volume with the snappedFS
# df –m snappedFS
– If snappedFS is out of space, try to free up space – possibly delete old
snapshots
# snapshot –d –n snapshot_name snappedFS

© Copyright IBM Corporation 2012


Topic 3 objectives
IBM Power Systems

After completing this topic, you should be able to:


• Explain potential problems in using SAN Copy
• Explain use of the JFS2 freeze and resume function
• Explain methods for accessing SAN Copy target LUNs

© Copyright IBM Corporation 2012


SAN Copy and file system cache
IBM Power Systems

• SAN Copy uses the storage subsystem contents


• Even with quiesced application, file system updates may be
cached in memory and unwritten to the storage subsystem
• Need to stop file system activity and flush memory cache
• Unmounting the file system would work, but online alternative
is needed
Kernel cache Storage subsystem

Transaction X0, Y0 X0, Y0

Write X1 X1, Y0 X1, Y0

Write Y1 X1, Y1 Update only in


memory

© Copyright IBM Corporation 2012


Use of JFS2 freeze and thaw
IBM Power Systems

1. JFS2 freeze will stop processing application write requests


and then will flush cached data to disk
# sync; chfs –a freeze=<timeout in sec> <FSname>

2. Use SAN Copy command for related LUNs

3. When SAN Copy completes, thawing the file system will


resume processing of application write requests
# chfs –a freeze=off <FSname>

• JFS2 freeze is not needed if the quiesced application:


– Uses Direct I/O or Concurrent I/O for the concerned files
– Issues fsync() to flush the file data after quiescing
© Copyright IBM Corporation 2012
Consistency groups
IBM Power Systems

• When multiple LUNs contain related information, sequential


SAN Copy of those LUNs can result in inconsistencies
• The storage subsystem should define related LUNs in the
same consistency group
• SAN Copy ensures a point in time copy across all LUNs in the
consistency group
• A SAN Copy of a file system log that is not consistent with the
SAN Copy of the file system data results in metadata
corruption
• All file systems using a given file system journal log must be
in same consistency group as the journal log
– JFS2 in-line logs, or
– Dedicated logs for each file system

© Copyright IBM Corporation 2012


Accessing SAN Copy data
IBM Power Systems

• SAN Copy target LUN is an exact copy of original disk,


including VGDA, LVCB, VGID, and PVID
• If using for rootvg recovery, boot from the target LUN
• If accessing the entire user volume group on a different AIX
system:
– Import using the importvg command
– Run varyonvg, fsck and mount file systems
• If accessing a user volume group on the same system:
– Import using the recreatevg command
– Run fsck and mount file systems

© Copyright IBM Corporation 2012


The recreatevg command
IBM Power Systems

recreatevg [-f][-y vgname] [-L label prefix] [-Y LV prefix] PVs


-y Specifies the name to use for the volume group
-L Parent directory for new file system mount points
-Y Prefix for new logical volume names
-f Force creation even with missing physical volumes

• Handles conflicts with still active volume group

• recreatevg –y oldvg –L /old –Y XX hdisk5 hdisk6


– Original names: /dev/myfs /myfs
– New names: /dev/XXmyfs /old/myfs

© Copyright IBM Corporation 2012


Checkpoint
IBM Power Systems

1. True or false: The creation of a snapshot volume group marks


all copies in the snapshot as stale.

2. True or false: The creation of a JFS split copy marks all of the
split mirror copies as stale.

3. True or false: After the creation of a JFS split mirror copy, the
administrator needs to mount the new file system in order to
access the split copy.

4. To access a SAN Copy of an active volume group on the


source system, use the command:
a. joinvg
b. importvg
c. recreatevg
© Copyright IBM Corporation 2012
Checkpoint solutions
IBM Power Systems

1. True or false: The creation of a snapshot volume group marks all copies in the
snapshot as stale.
The answer is false.

2. True or false: The creation of a JFS split copy marks all of the split mirror copies
as stale.
The answer is true.

3. True or false: After the creation of a JFS split mirror copy, the administrator needs
to mount the new file system in order to access the split copy.
The answer is false.

4. To access a SAN Copy of an active volume group on the source system, use the
command:
a. joinvg
b. importvg
c. recreatevg
The answer is recreatevg.
© Copyright IBM Corporation 2012
Exercises: Advanced backup techniques
IBM Power Systems

• Use a snapshot volume group

• Use JFS split copy (optional)

• Use JFS2 snapshots

• Use a file system as a recovery source

© Copyright IBM Corporation 2012


Unit summary
IBM Power Systems

Having completed this unit, you should be able to:


• Explain factors related to online backup consistency
• Use JFS split mirror to back up file system data
• Use a snapshot volume group to backup file system data
• Use JFS2 snapshot to back up file system data
• Explain AIX considerations in using SAN Copy facilities

© Copyright IBM Corporation 2012

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy