Operating System - HP-UX
1833726 Members
2634 Online
110063 Solutions
New Discussion

Disk copy on smaller target

 
GARREC CLAUDE
Occasional Contributor

Disk copy on smaller target

I want to make a copy from my system (lvm)disk:4.3Gbwith less than 2Gb used the destination will be a smaller disk 2Gb

I cannot use dd

I suppose I must copy directly after mounting the destination disk but I don't know how to create the logical volume, mount, copy...




5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Disk copy on smaller target

I would suggest a backup/restore approach using tar or find piped to cpio to capture just what you need.


Pete

Pete
G. Vrijhoeven
Honored Contributor

Re: Disk copy on smaller target

Hi,

pvcreate /dev/rdsk/c?t?d? ( new disk)
vgextend /dev/ /dev/dsk/c?t?d? ( new disk)
lvcreate -L /dev/ /dev/dsk/c?t?d?
newfs /dev//
mkdir /mountpoint
mount /dev/ / /mountpoint
cd /mountpoint
stop all prosseses active on the old lvol
cd fromdir ; tar cf - . | ( cd todir ; tar xf - )

umount /oldmount
umount /mountp
mount /dev//lvol /oldmount
lvreduce /oldlvol
vgreduce /dev/ /dev/dsk/4gbdisk

Now it is free again.

If it is your root disk, you can make an ignite tape and resintall from tape.

Gideon
Elmar P. Kolkman
Honored Contributor

Re: Disk copy on smaller target

If CPU cycles are available, you could try to compress the data (compress, bzip2, gzip).

But it depends on what you want with the copy. And what you want to copy. And if you have licenses for, for instance, mirror UX.

Is the data used on the 4.3 Gb less then the total size of the destination disk?

What you could do:
1) pvcreate
2) mkdir /dev/vgtmp ; mknod /dev/vgtmp/group c 64 0x990000
3) vgcreate vgtmp
4) vgchange -a y vgtmp
5) lvcreate -l vgtmp
6) newfs -F vxfs /dev/vgtmp/rlvol1
7) mount /dev/vgtmp/lvol1 /mnt
8) cd
9) cp -rp . /mnt
10) umount /mnt
11) vgexport vgtmp

Then you can do vgimport on the system you want to use the data again.
Every problem has at least one solution. Only some solutions are harder to find.
John Carr_2
Honored Contributor

Re: Disk copy on smaller target

Hi

If you are trying to amke a system image to build on another box with a smaller disk or to change the disk to a smaller one in the existing box you can use ignite.
first make a note of the disk usage for each filesystem

make_recovery -A

when you restore to the destination disk do it interactively and reduce the file system sizes to reflect the usage recorded earlier.

I normally use this method for increasing filesystems such as root on workstations but principles should be same for decreaing.

:-) John.
Jeff Schussele
Honored Contributor

Re: Disk copy on smaller target

Hi Claude,

Since the target is smaller you cannot use dd as you've found. You can use cpio as follows:

cd /top_dir
find . -depth -print | cpio -pd /new_top_dir

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!