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

Re: Moving to LVM



In <[🔎] 20090316183713.GA511@fuchs>, André Berger wrote:
>My plan is to create a Logical Volume Group to span two partitions
>located on different disks, and export that LV group via NFS. If I
>got it right (please correct me), I need partitions of type 8e on
>both disks.

LVM is happy to use any block device as a PV.  I use whole disks in some 
cases and partitions in other cases.  Even if you are using partitions, they 
don't have to be of type 8e normally.  (I have found some installer programs 
that don't like it when your PVs are not partitions of type 8e, but I 
consider those broken; the LVM core is not picky in that regard.)

>So I thought I
>
>1 partition disk2 8e
>2 create a LV group and add disk2/p1 to it
2a Create a PV from disk2/p1
2b Create a VG containing one PV, disk2/p1
2c Create a LV from that VG. 
>3 create an ext3 filesystem on the LV
>3 copy the data from disk1/p1 to the LV
>4 partition disk1/p1 8e
>5 add disk1/p1 to the LV group
5a Create a PV from disk1/p1
5b Extend the existing VG by adding disk1/p1
>6 resize the LV ext3 filesystem to 2 TB, so it spans both disks resp.
>  partitions

>Does this sound right to you? Maybe you could help me with the
>necessary command as well...

# disk1/p1 = /dev/sda1
# disk2/p1 = /dev/sdb1
pvcreate /dev/sdb1
vgcreate vg_name /dev/sdb1
lvcreate -L size -n lv_name vg_name
mkfs.ext3 /dev/mapper/vg_name-lv_name
mkdir /mnt/old
mkdir /mnt/new
mount /dev/sda1 /mnt/old
mount /dev/mapper/vg_name-lv_name /mnt/new
rsync -aHAX --progress --stats /mnt/old/. /mnt/new/.
umount /mnt/old
umount /mnt/new # Entirely optional.
pvcreate /dev/sda1
vgextend vg_name /dev/sda1
lvextend -L new_size vg_name/lv_name

I think that's correct, but I'm not looking at a man page right now and it's 
been a while since I needed to extend a VG.

>What happens if, for whatever reason, just one of the disks is
>available?

The entire VG is unavailable.  It can be manually brought up in partial 
mode.  In partial mode, only the LVs that reside entirely on available disks 
will be available -- they must have NO sectors allocated on unavailable 
disks.  In a disaster recovery scenario, it is possible to insert a 
different device (/dev/zero might work, usually a new disk is better) as the 
missing PV, but this should be a last-resort behavior.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: