Showing results for 
Search instead for 
Did you mean: 

raw device backup on mounted file system.

Occasional Contributor

raw device backup on mounted file system.

Is it ok to take dd backup of raw device files
(oracle datafiles)in to mounted file systems?


dd if=/dev/vg03/datafile1 of=/oracle/dfile1
dd if=/dev/vg03/datafile2 of=/oracle/dfile2

taking backup of the dd files created by
above commands using tar


tar -cv /oracle/*

Is this method is correct?Any problem in it?

Is any one using like this?

Thanks & Regards
Andreas Voss
Honored Contributor

Re: raw device backup on mounted file system.

Andreas Voss
Honored Contributor

Re: raw device backup on mounted file system.


i assume that you have a logical volume named /dev/vg03/datafile1
if you want to make a backup of this with dd you have to use the raw device:
So the command looks like:
dd if=/dev/vg03/rdatafile1 of=/oracle/dfile1 bs=64k
I think the raw volume has NO tar structure so you cannot use tar to extract from /oracle/dfile1
The only way is to full restore with the dd command:
dd if=/oracle/dfile1 of=/dev/vg01/rdatafile1 bs=64k


John Palmer
Honored Contributor

Re: raw device backup on mounted file system.

If it is you intention to end up with the backup file on tape then why not dd the raw volume direct to tape in the first place?

You could tar up the dd'd files in the filesystem but it seems like a large overhead (diskspace and processing) to me.

If you use:-

dd if=/dev/vg03/rdatafile1 of=/dev/rmt/?mn bs=32k

dd if=/dev/vg03/rdatafile2 of=/dev/rmt/?mn bs=32k

(substitute your appropriate tape drive number for the ? above)

Then both files will be copied to the tape in sequence. In order to restore a particular volume, rewind the tape, position to the required file on tape using the 'mt fsf' command then restore with
dd if=/dev/rmt/?mn of=/dev/vg03/r bs=32k

Obviously, you should consider writing a more clever backup script to wrap around the dd commands. This should also maintain a log of what file is where on tape to facilitate restores.

We use this technique on a number of servers with raw Oracle volumes and it works very well. It is also quick and reliable using DLT tapes.


Stefan Farrelly
Honored Contributor

Re: raw device backup on mounted file system.

You should only dd raw lvols if they are unmounted otherwise your data could be inconsistent. So, if your lvols are unmounted then you have to use the raw lvol to copy them, eg; dd if=/dev/vgXX/rlvolYY of=/dev/vgXX/rlvolZZ bs=1024k

Once the copy is completed you can then mount /dev/vgXX/lvolZZ and then use tar to write to a tape device no problem. The only reason I can think of you wanting to do it this way is if you may need to recover an individual file whereas if you dd direct to tape instead you would need to restore the entire lvol just to get 1 file back.

However, using dd to make a copy of an lvol may not be the fastest method. If you have say a 9Gb lvol but only 3Gb of data on it then using raw dd to make a copy will copy the entire 9Gb (which in this case is a waste). Instead use find | cpio to copy it to a second lvol, this will only copy your 3Gb of data and be much faster, AND have the benefit of not having to unmount both the lvols. If you instead have say 6Gb of data on your 9Gb lvol then using raw dd to copy it would be faster (as generally using raw dd is x2 faster than using a copy command due to it not using the Unix buffer cache).

Im from Palmerston North, New Zealand, but somehow ended up in London...
Dan Am
Frequent Advisor

Re: raw device backup on mounted file system.

my 0.02:
what you might be looking for is the "snapshot" capability of VxFS.

Before backup a disk buffer is created, that logs any chnges and ignores them during the backup.

might not work with raw-device though, but you can still backup your db-file

maybe that helps
do what you can. don't if you can't.