1832478 Members
2691 Online
110043 Solutions
New Discussion

Re: Tar backup

 
AjitKumar
Occasional Contributor

Tar backup

Hi,

I want to take a backup of a particular file system on an HP-UX machine using tar.

Now instead of a tape I want this to be backed up in a disk.



Kindly advice if this is possible using tar. If not what other backup commands can be used to achieve the same.



Kindly note that the disk I am talking is a RAW disk and does not contain any file system.

It is just an ordinary PV unassigned to any VG.



Thanks and Regards,

Ajit Kumar.R

11 REPLIES 11
Hemmetter
Esteemed Contributor

Re: Tar backup

Hi Ajit,

Just

# tar cvf /dev/dsk/cXtYdZ "your-files"




rgds
HGH
Peter Godron
Honored Contributor

Re: Tar backup

Ajit,
if your input device is RAW,I don't think tar will work, as it is file-system based.

You may be better of with something like:
dd -if= -of

Please also note from "man dd":
" If if or of refers to a raw disk, bs should always be a multiple of
the sector size of the disk. By default, bs is 512 bytes. If the
sector size of the disk is different from 512 bytes, bs should be
specified using a multiple of sector size. The character special
(raw) device file should always be used for devices."


Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Joelmel Roche
Valued Contributor

Re: Tar backup

Hi Ajit,

I hope can help this ff command using cpio.

Duplicating cpio(1) tapes

Copy contents of cpio(1) tape to disk:
# dd if=/dev/rmt/ of=/tmp/cpio.contents bs=5k

Copy disk file to new tape:
# dd if=/tmp/cpio.contents of=/dev/rmt/ bs=5k

Verify new tape is readable by cpio(1):
# cpio -icvBt < /dev/rmt


fbackup(1M) (or SAM) tapes

Note: Unfortunately, fbackup(1M) (and SAM) creates backup
volumes with a format that makes duplication of volumes by dd(1)
impossible.

See fbackup(1M) manpage for more information.
Ganesh Balraman
Regular Advisor

Re: Tar backup

Dear Ajit,

dd if=/data of=/dev/dsk/c1t5d0 (eaxmple).

dd will be the option for raw device usage.

Regds
B.Ganesh
V. Nyga
Honored Contributor

Re: Tar backup

Hi,

I think 'dd' is a very good command for what you want.
So you get a identical duplicate of your disk.

But Peter's command is maybe a little bit confusing - note: '-if' is your source and '-of' is your target. You can use the raw device for both disks.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Yogeeraj_1
Honored Contributor

Re: Tar backup

hi Ajit,

what type of application are your running?

Make sure that you have stopped the application or database system before doing the backup of the raw device...

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
V. Nyga
Honored Contributor

Re: Tar backup

Hi again,

and:
your target disk has to be as big as the source disk (or can be bigger).

V.
*** Say 'Thanks' with Kudos ***
Raj D.
Honored Contributor

Re: Tar backup

Ajit,

Also you can monitor the dd process with iostat command , grepping the source and target disk name.

Cheers,
Raj
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: Tar backup

Ajit,

Also you can monitor the dd process with iostat command , grepping the source disk name , with keeping an eye on bps ( Kilobytes transferred per second.), from another session.

Cheers,
Raj
" If u think u can , If u think u cannot , - You are always Right . "
Peter Nikitka
Honored Contributor

Re: Tar backup

Hi,

reading Ajit's request carefully, I see he wants to backup a FILESYSTEM to a disk device (instead of a tape device).
This is perfectly legal and can be done by tar, when the target (disk) device is NOT used as a filesystem or for anything other (swap, db,...).

root@hp2[209] lvcreate -n tape2 -l 512 vg01
root@hp2[210] cd /
root@hp2[211] tar cf /dev/vg01/tape2 etc
root@hp2[212] tar tvf /dev/vg01/tape2
r-xr-xr-x 2/2 0 Nov 29 18:04 2006 etc/
rw-r--r-- 0/3 426 Jul 29 18:31 2005 etc/fstab
rw-r--r-- 0/0 736 Jan 10 06:56 2007 etc/mnttab
...

Keep in mind, you must KNOW, that there is a tar output located at this device, though a check like this may help:

root@hp2[213] dd if=/dev/vg01/lvol2 of=/tmp/www bs=5k count=1
1+0 records in
1+0 records out
root@hp2[214] file /tmp/www
/tmp/www: tar file

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Peter Godron
Honored Contributor

Re: Tar backup

Ajit,
can you please update this thread.

Could you please complete the thread by awarding points to helpful answers and summarising the solution for you.

This will help resolution of similar problems in the future.