<

Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

Backing Up a Solaris File System Dynamically

Published on
8,709 Points
2,709 Views
Last Modified:
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility in the Solaris OS can do an online backup, it will fail if the file system can't be write-locked.
Solaris Volume Manager software, on the other hand, can be used as a "bridge" to transfer the data of a file system across to another partition on the fly. Then, the data can be backed up at any time.
Here's an example using the file system /test:
# df -k /test
Filesystem                  kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t2d1s3    50700783 39746386 10530839    80%    /test

Open in new window

First, you'll create a metadevice named d101 on the /test file system when it's mounted.
# metainit -f d101 1 1 c0t2d1s3

Open in new window

Now it's time to initialize a one-way mirror metadevice named, for example, d100, with the submirror d101 that you've already created:
# metainit d100 -m d101
# metastat d100
d100: Mirror
    Submirror 0: d101
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 102961152 blocks

d101: Submirror of d100
    State: Okay
    Size: 102961152 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c0t2d1s3                   0     No    Okay

Open in new window

And you'll create another metadevice d102 on the new location c0t2d1s7. The size of the new partition should be the same as d101:
 
# metainit d102 1 1 c0t2d1s7
d102: Concat/Stripe is setup

# metastat d102
d102: Concat/Stripe
    Size: 102975488 blocks
    Stripe 0:
        Device              Start Block  Dbase
        c0t2d1s7                   0     No

Open in new window

When you add the metadevice d102 as the second submirror to d100, resynchronization will automatically take place:
# metattach d100 d102

Open in new window

After the resynchronization has completed successfully, you should get the following two-way mirrors that indicate that the file system is ready to be backed up:
# metastat d100
d100: Mirror
    Submirror 0: d101
      State: Okay
    Submirror 1: d102
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 102961152 blocks

d101: Submirror of d100
    State: Okay
    Size: 102961152 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c0t2d1s3                   0     No    Okay

d102: Submirror of d100
    State: Okay
    Size: 102961152 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c0t2d1s7                   0     No    Okay

Open in new window

You can schedule your file system backup to run any time you wish. Before you start, though, you have to detach the second metadevice d102 or bring it offline. To detach it, use:
# metadetach d100 d102 
Or, to bring it offline, use: 
# metaoffline d102

Open in new window

Remember, you're only backing up the data on the partition c0t2d1s7, which includes all the data at the point of detach.
After the backup is done, you can clean up all the metadevices, or you could leave them for later use. Before the next backup, you'll have to run either of the following commands:
# metattach d100 d102  
or
# metaonline d102

Open in new window

You'll need to wait until the resynchronization is done before the next backup.
The difference between the two preceding options is that the first option will take longer to sync after the metattach command than the second one. But for the second option, the file system will be read-only until you bring it online by using the metaonline command.
For file systems that need to be backed up consistently at the same point, all you have to do is detach all of the second metadevices at the same time. Then they can be backed up one by one.
0
Comment
Author:Joseph Gan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
0 Comments

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Join & Write a Comment

Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month