Operating System - HP-UX
1820590 Members
1833 Online
109626 Solutions
New Discussion

copy data between lvs with dd command

 
SOLVED
Go to solution
Prasanth V Aravind
Trusted Contributor

copy data between lvs with dd command

I am trying to copy data from one lv (which is in old disk) to another lv (which is in new disk) with dd command. These are the steps I had followed.


1. create new VG with commands ( pvcreate , mkdir /dev/vg , mknod, vgcreate )

2. create new lv with commands ( lvcreate ) - I didn’t format new lv

3. copy data from old to new lv

dd if =/dev/vgold/lv of=/dev/vgnew/lv bs=1024 conv=sync
2000+0 records in
2000+0 records out

command get finished successfully though I am not able to mount the new file system .

# mount / dev/vgnew/lv /tmp_lv
vxfs mount: /dev/vgnew/lv corrupted. needs checking

I tried to copy between raw devices also. The result was same …
Please tell me what I was missing ……

thanks & Regards
Prasanth
7 REPLIES 7
AwadheshPandey
Honored Contributor

Re: copy data between lvs with dd command

use fsck -y on new file system. better to create a mirror copy of particular lv and then split in two parts.
use lvextend and lvsplit
http://docs.hp.com/en/B2355-90691/lvsplit.1M.html
all u need Mirror-UX installed
It's kind of fun to do the impossible
Danny Petterson - DK
Trusted Contributor

Re: copy data between lvs with dd command

Maybe you should try:

fsck -F vxfs /dev/vgnew/lv

or

fsck -o full /dev/vgnew/lv

Another suggestion could be to use vxdump/vxrestore as an alternative to dd?

Good luck
Danny Petterson
Steven E. Protter
Exalted Contributor

Re: copy data between lvs with dd command

Shalom,

After a dd command it is normally necessary to fsck the filesystem. If you got the block size wrong that could also have you end up with usless output.

Do an lvdisplay -v on the source logical volume and modify your dd command to meet the structure of the source rpm as much as possible.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Aneesh Mohan
Honored Contributor
Solution

Re: copy data between lvs with dd command

Hi Prasanth,

fsck -y /dev/vgname/rlvname will fix ur issue.


fyi,

# bdf /test1

/dev/vg00/lvol11 131072 131068 4 100% /test1


# lvcreate -L 200 /dev/vg00
Warning: rounding up logical volume size to extent boundary at size "224" MB.
Logical volume "/dev/vg00/lvol13" has been successfully created with
character device "/dev/vg00/rlvol13".
Logical volume "/dev/vg00/lvol13" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf


# dd if=/dev/vg00/rlvol11 of=/dev/vg00/rlvol13 bs=1024k
160+0 records in
160+0 records out


# mount /dev/vg00/lvol13 /test2
vxfs mount: /dev/vg00/lvol13 is corrupted. needs checking

# fsck -y /dev/vg00/rlvol13
fsck: /etc/default/fs is used for determining the file system type
log replay in progress
replay complete - marking super-block as CLEAN

# bdf /test2
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol13 131072 131068 4 100% /test2
Prasanth V Aravind
Trusted Contributor

Re: copy data between lvs with dd command

thanks for replay ....

can i use the dd command, if i want to copy raw data (used by oracle).


in such case which device file i have to take for copy (/dev/oldvg/lv or /dev/oldvg/rlv)

in such case , how will i chcek for oracle raw data once i have done the copy ?


thanks
Prasanth
AwadheshPandey
Honored Contributor

Re: copy data between lvs with dd command

visit the link below, your all doublt regarding this will clear
http://sl-workstations.web.cern.ch/sl-workstations/documentation/SAGpart-7.html

Awadhesh
It's kind of fun to do the impossible
Bill Hassell
Honored Contributor

Re: copy data between lvs with dd command

Your copy of the lvol will *ALWAYS* report corruption because you copied an active (mounted) filesystem. This is the same as when your system loases power -- filesystems were not properly unmounted and you must run fsck to fix the problem.

Always use the raw lvol when using dd. The cooked lvol runs data through the buffer cache, a waste of resources and time. Did you notice the bs setting? bs=1024 is EXTREMELY small, use bs=256k or even bs=1024k.

> can i use the dd command, if i want to copy raw data (used by oracle).

Yes.

> in such case which device file i have to take for copy (/dev/oldvg/lv or /dev/oldvg/rlv)

Always use the raw device for dd, whether the lvol is raw or has a filesystem. This improves the performance.

> in such case , how will i check for oracle raw data once i have done the copy ?

There is only one way: run Oracle and see if it recognizes and validates the results. You can look at a couple of sectors using dd piped to xd but it's all binary patterns.

dd if=/dev/oraraw/rlvol2 bs=1024 count=20 | xd -xc


Bill Hassell, sysadmin