Problem
This article contains a procedure for replaying a metasave of a VxFS file system by using a sparse volume.
Solution
This article is a part of a set on troubleshooting file system corruption. Click here to start at the beginning: https://www.veritas.com/docs/000017547 |
Table of Contents
1. Introduction
2. Create a cache object
3. Create a sparse volume
4. Replay the metasave
1. Introduction
(Back to top)
Since a sparse volume has minimal space requirements, it can be used to replay a metasave for larger volumes without using a significant amount of storage. The benefit of replaying a metasave on a temporary volume is that it allows the use of utilities that affect file system metadata, such as fsck -y and fsdb, without affecting the original file system.
Warning: This procedure should not be performed on a production server. If a cache object unexpectedly runs out of space, vxconfigd may become unresponsive.
2. Create a cache object
(Back to top)
Create a new volume and designate it as a cache object. The cache object can then be used in a similar manner as a disk, but in a space-optimized fashion that is useful for sparse volumes.
Table 1 - Creating a cache object
Step | Description | Syntax and example |
2a | Create a new volume that is at least slightly larger than the size of the metasave file. In this example, the metasave file is 600 MB, so a volume of 1 GB is created. |
Syntax: vxassist -g <disk group> make <provide name for a new volume> <size> Example, with typical output: # vxassist -g datadg make cachevol 2048000 |
2b | Create a cache object and associate it with the volume that was just created. | Syntax: vxmake -g <disk group> cache <provide name for a new cache object> cachevolname=<cache volume> autogrow=on Example, with typical output: # vxmake -g datadg cache cacheobject cachevolname=cachevol autogrow=on |
2c | Start the cache object. | Syntax: vxcache -g <disk group> start <cache object name> Example, with typical output: # vxcache -g datadg start cacheobject
Note: Vxprint now shows a cache object that is enabled.
# vxprint -C |
3. Create a sparse volume
(Back to top)
Use vxmake to create the layers that are required for a volume, including the subdisk, plex and the volume itself. Instead of a normal volume, these steps result in the creation of a sparse volume.
Table 2 - Creating a sparse volume
Step | Description | Syntax and example |
3a | Create a subdisk that is the exact length of the source volume and associate it with the cache object that was created in Step 1. Specifying the length in sectors is recommended. Since this will be used by a sparse volume, the length specified here is theoretical. Very little of the length will actually be used. |
Syntax: vxmake -g sd <provide name for a new subdisk> len=<exact length of source volume> dm=<cache object> Example, with typical output: # vxmake -g datadg sd cacheobject-01 len=6291456000 dm=cacheobject |
3b | Create a plex and associate it with the subdisk that was previously created. | Syntax: vxmake -g <disk group> plex <provide name for a new plex> sd=<name of subdisk> Example, with typical output: # vxmake -g datadg plex sparsevol-01 sd=cacheobject-01 |
3c | Create a sparse volume and associate it with plex that was previously created. | Syntax: vxmake -g <disk group> vol sparsevol usetype=fsgen plex=<name of plex> Example, with typical output: # vxmake -g datadg vol sparsevol usetype=fsgen plex=sparsevol-01 |
3d | Start the sparse volume. | Syntax: vxvol -g <disk group> start <sparse volume> Example, with typical output: # vxvol -g datadg start sparsevol Note: Vxprint now shows an active volume.
|
4. Replay the metasave
(Back to top)
Use one of the provided metasave scripts to replay the metasave to the sparse volume. The metadata from the source volume can now be reviewed using utilities such as fstyp, fsck or fsdb without affecting the original volume.
Table 3 - Replaying a metasave
Step | Description | Syntax and example |
4a | Run the metasave script that matches the operating system and platform. Point it to the metasave output file, and provide a path to the sparse volume. | Syntax: /opt/VRTSspt/FS/MetaSave/metasave_<os> -r -f <metasave file> <path to sparse volume> Example, with typical output: # /opt/VRTSspt/FS/MetaSave/metasave_rhel6_x86_64 -r -f /var/tmp/metasave.out /dev/vx/rdsk/datadg/sparsevol # |
4b | Use fstyp to view the superblock of the sparse volume. The metadata should match the source volume. | Syntax: fstyp -v <path to the sparse volume> Example, with typical output: # fstyp -v /dev/vx/rdsk/datadg/sparsevol |
4c | (Optional) Run fsck -y on the sparse volume that now contains the metasave replay. This can be used to "predict" the effect that running fsck -y will have on a file system without actually running it on production data. | Syntax: fsck -t|F vxfs -y <path to the sparse volume> Example, with typical output: # fsck -t vxfs -y /dev/vx/dsk/datadg/sparsevol |