[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] Question on duplicating equally-sized HDs with dd and changing VG name and PV UUIDs



On Fri, Sep 07, 2007 at 02:13:07PM +0200, Holger Rauch wrote:
> Hi,
> 
> I got a machine having two HDs of the same size (250 GB each), devices
> /dev/sda and /dev/sdb. /dev/sda contains VG rootvg which in turn contains
> several LVs. VG rootvg consists of one PV, /dev/sda5. All this was set up
> using LVM2.
> 
> I want to have the same HD partition/VG/LV layout on /dev/sdb with the
> following differences:
> 
> - A different VG name: backupvg instead of rootvg
> - A different UUID for PV /dev/sdb5 (since that's supposed to be the underlying
>   PV for VG backupvg)
> 
> Purpose of that setup is to be able to easily copy filesystem contents
> between filesystems located on LVs of the same name but in different VGs.
> (Apart from that, the filesystems are of the same type and size).

now, why would you want to dd the full disk,
and then change thr uuids?
what is wrong with
 sfdisk -d /dev/sda | sfdisk /dev/sdb
 lvs -o attr,name,size --noheadings rootvg |
 while read a n s; do
 	[[ $a == -* ]] || continue;
	lvcreate -L $s -n $n backupvg ;
	# dd bs=1M if=/dev/rootvg/$n of=/dev/backupvg/$n
 done
?

-- 
: Lars Ellenberg                            Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH      Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe    http://www.linbit.com :


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]