Thursday, June 28, 2012

How to open a tar file in Unix or Linux?

A lot of the downloadable Linux or Unix files found on the internet are compressed using a tar or tar.gz compression format. So, knowing how to open or untar these compressed files becomes very important. In the following examples, we will explain how to untar both popular formats and how to extract the contents to a different directory.

How to open or Untar a "tar.gz" file in Linux or Unix:

The following tutorial assumes the name of your file is yourfile.tar.gz Replace with your actual filename.

1. From the terminal, change to the directory where yourfile.tar.gz has been downloaded.
2. Type tar -zxvf yourfile.tar.gz to extract the file to the current directory.

You can specify a different directory to extract to using -C parameter and a path to the directory as follows:

Example: tar -C /myfolder -zxvf yourfile.tar.gz

How to open or Untar a "tar" file in Linux or Unix:

1. From the terminal, change to the directory where yourfile.tar has been downloaded.
2.Type tar -zxvf yourfile.tar to extract the file to the current directory.
3. Or tar -C /myfolder -zxvf yourfile.tar to extract to another directory.

How Can I Do Archiving With Tar?
The tar Command

The tar (tape archive) command bundles a bunch of files together and creates an archive (commonly called a tar file or tarball) on a tape, disk drive, or floppy disk. The original files are not deleted after being copied to the tar file. To create an archive using tar, use a command like this, which bundles all the files in the current directory that end with .doc into the alldocs.tar file:

tar cvf alldocs.tar *.doc

Here's a second example, which creates a tar file named panda.tar containing all the files from the panda directory (and any of its subdirectories):

tar cvf panda.tar panda/

In these examples, the c, v, and f flags mean create a new archive, be verbose (list files being archived), and write the archive to a file. You can also create tar files on tape drives or floppy disks, like this:

tar cvfM /dev/fd0 panda Archive the files in the panda directory to floppy disk(s).
tar cvf /dev/rmt0 panda Archive the files in the panda directory to the tape drive.

The /dev/fd0 entry is Linux-ese for "floppy drive zero" (your A drive under DOS), and /dev/rmt0 means "removable media tape zero," or your primary tape drive. The M flag means use multiple floppy disks--when one disk is full, tar prompts you to insert another.

To automatically compress the tar file as it is being created, add the z flag, like this:

tar cvzf alldocs.tar.gz *.doc

In this example, I added the .gz suffix to the archive file name, because the z flag tells tar to use the same compression as the gzip command.

To list the contents of a tar file, use the t (type) flag in a command, like this:

tar tvf alldocs.tar List all files in alldocs.tar.

To extract the contents of a tar file, use the x (extract) flag in a command, like this:

tar xvf panda.tar Extract files from panda.tar.

This will copy all the files from the panda.tar file into the current directory. When a tar file is created, it can bundle up all the files in a directory, as well as any subdirectories and the files in them. So when you're extracting a tar file, keep in mind that you might end up with some new subdirectories in the current directory.

We've used several different flags in the sample tar commands so far. Here's a list of the most common flags:

c Create a new archive.
t List the contents of an archive.
x Extract the contents of an archive.
f The archive file name is given on the command line (required whenever the tar output is going to a file)
M The archive can span multiple floppies.
v Print verbose output (list file names as they are processed).
u Add files to the archive if they are newer than the copy in the tar file.
z Compress or decompress files automatically.

For more information on the tar command, see the tar manual.

Friday, June 22, 2012

Dynamic Root Disk (DRD)

DRD Concepts : -
Minimizing Downtime with Dynamic Root Disk

HP's Dynamic Root Disk (DRD) product is a new tool that enables software maintenance and recovery on an HP-UX operating system with minimum system down time. Using DRD, you can easily and safely copy a system image from vg00 to a "clone" volume group.

DRD ensures that the clone volume group's LVM structure, file systmes, files, and directories are identical to the original volume group. If the original boot disk is mirrored, DRD can optionally create a mirror in the clone volume group, too.

When the administrator installs software or patches, or modifies configuration files on the active boot disk, the clone remains unchanged.

DRD clone functionality can potentially decrease both planned and unplanned downtime.

DRD Benefit: Minimizing Unplanned Downtime:

Most HP-UX administrators implement disk mirroring to protect against disk hardware failures. However, a careless typo by a system administrator, security breaches, and critical software defects could corrupt both mirrors. In some cases, the administrator can only recover by booting from a system recovery tape, which requires system downtime.

If the failed system has a DRD clone, the administrator can simply activate and boot the DRD clone, which requires much less downtime.

DRD Benefit: Minimizing Planned Downtime:

Installing software and patches sometimes requires system downtime.

Using DRD commands, you can apply patches, install software products and make other modifications to the cloned system image without affecting the active system image. Then during the next convenient maintenance window, reboot the system from the patched/cloned system image with very minimal downtime. If the patches cause problems for applications, simply reboot using the original disk.

DRD Rehosting:

All DRD functionality, with the exception of rehosting, is now supported on HP-UX 11iv3 systems using VxVM 5.0 root volumes.

Creating and Updating a Clone:

If you have the MirroDisk/UX license, you can create a mirrored clone.

DRD also supports cloning of a VxVM root on HP-UX 11i v3.

Accessing Inactive Images via DRD-Safe Commands:

Administrators can execute commands on the inactive image via the drd runcmd
utility. DRD includes safeguards to ensure that commands executed via this utility never affect the
active system image. drd runcmd can only be used to execute "DRD-Safe" commands.
Attempts to use drd runcmd to execute commands that aren't DRD-Safe fail.
The current DRD-Safe list includes nine commands:

* swinstall
* swremove
* swlist
* swmodify
* swverify
* swjob
* kctune
* update-ux
* view

Activating an Inactive Image:

The administrator can use the drd activate command to reboot the system using the inactive system image at any time. Booting from the inactive system image offers a number of benefits:

* If accidental or intentional changes to the active system image cause problems, boot from the inactive image to restore system functionality without a time consuming tape restore.

* After installing patches on the inactive system image with drd runcmd swinstall, activate the inactive system image during the next maintenance window to make the new patches take effect.