Skip to contentSkip to conversation

Setting up LVM with existing RAID 1 (Mirror)

linux-lvm Rehan 2 participants 2 messages Jun 26, 2006 – Jun 27, 2006

lore
Share & tools
lore

Rehan

author
#0 lore raw

Hi All,
I have SUSE 9.0 SP2 installed with two 70GB Hardware RAID 1(Its a DEll Poweredge mirrored). We have an /opt partition which is alomst full. We need to use LVM to expand OPT. We have plenty of free space on the disk. I think LVM2 is installed but not configured since we have a lvm.conf file under /etc/lvm. I have not used LVM before so I was wondring if you guys can help me out with what needs to be done to expand /opt. My first question is it possible to expand opt using LVM with existing RAID 1. My second question is do we have to break the mirror and what are the steps involved to get it done? If you guys know of any document that I can read and figure this out it would be great.

dda006:/etc/lvm # lvscan
No volume groups found

dda006:/etc/lvm # fdisk -l

Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id
System
/dev/sda1 * 1 784 6297448+ 83
Linux
/dev/sda2 785 8907 65247997+ f
W95 Ext'd (LBA)
/dev/sda5 785 1176 3148708+ 82
Linux swap
/dev/sda6 1177 1960 6297448+ 83
Linux
/dev/sda7 1961 2744 6297448+ 83
Linux
/dev/sda8 2745 3528 6297448+ 83
Linux
/dev/sda9 3529 3790 2104483+ 83
Linux
/dev/sda10 3791 4052 2104483+ 83
Linux
dda006:/etc/lvm # df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             6.1G  1.2G  4.9G  20% /
tmpfs                1013M   12K 1013M   1% /dev/shm
/dev/sda9             2.1G  1.4G  699M  66% /home
/dev/sda8             6.1G  5.6G  435M  93% /opt
/dev/sda10            2.1G  1.3G  778M  63% /tmp
/dev/sda6             6.1G  2.5G  3.6G  41% /usr
/dev/sda7             6.1G  149M  5.9G   3% /var

hco431brgdda006:/etc/lvm #

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw

Hi Rehan,

If I have a look at your partition table

Quoted 4 lines

Disk /dev/sda: 73.2 GB, 73274490880 bytes
255 heads, 63 sectors/track, 8908 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Quoted 9 lines
   Device Boot Start    End      Blocks   Id System
/dev/sda1   *      1    784     6297448+  83 Linux
/dev/sda2        785   8907    65247997+   f W95 Ext'd (LBA)
/dev/sda5        785   1176     3148708+  82 Linux swap
/dev/sda6       1177   1960     6297448+  83 Linux
/dev/sda7       1961   2744     6297448+  83 Linux
/dev/sda8       2745   3528     6297448+  83 Linux
/dev/sda9       3529   3790     2104483+  83 Linux
/dev/sda10      3791   4052     2104483+  83 Linux

it seems /dev/sda2 is a container holding sda5-10 as logical partitions. This concept is similar to a LVM layout, where sda2 would be a physical volume (PV) containing several logical volumes (LV) like /opt /home swap etc.

But even if you have a lot of free space within sda2, it does not help you, as long as the whole disk is occupied by sda2. You have to get rid of all the logical partitions :-(

But you may keep your root partition :-)

step 1: erase sda5-10

You may copy /usr /var and /home into your root partition (use: cp -a). Swap can be disabled for a while. But you have to save /opt (may be /tmp) to an additional disk. Then you are able delete sda5-10.

step 2: initialize LVM / create a logical volume

Turn sda2 into a PV with "pvcreate /dev/sda2". Create a logical volume: "vgcreate volume1 /dev/sda2". You may choose any other name instead of "volume1". Now you create your LVs as needed:

lvcreate volume1 -n swap -l 2G
lvcreate volume1 -n usr -l 6G
lvcreate volume1 -n opt -l 12G
....

mkswap /dev/volume1/swap
mke2fs /dev/volume1/usr
mke2fs /dev/volume1/opt
...

step 3: copy back the data to your newly created LVs.

conclusion:

Your new LVs have real names instead of just /dev/sda8. Any free space you have may be assigned to any of your LVs, as they don't have to be continuous any more. Anyway, dealing with additional disk space is MUCH easier once after you started using LVM.

Dieter.