Operating System - Linux
1755438 Members
3306 Online
108833 Solutions
New Discussion юеВ

Add new disk using LVM on RedHat AS 4.0

 
SOLVED
Go to solution
Gulam Mohiuddin
Regular Advisor

Add new disk using LVM on RedHat AS 4.0

Hi,

I need to use one disk already installed on my Linux Server:

Red Hat AS 4.0:

Note: (Physical Volume pvcreate is already performed by someone else).

1. Create new Volume Group VolGroup01 using (/dev/sdb1).
2. Create new Logical Volumes LogVol01 (30GB) & LogVol02 (30GB) in new VolGroup VolGroup01.
3. Make two volumes of 30 GB each.
4. Format the new volumes.
5. Mount them on /u02 (30GB) and /u03 (30GB).
6. FSTAB entires.

[root@wolfdev03 ~]# fdisk -l

Disk /dev/sda: 73.4 GB, 73406611456 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 8924 71577607+ 8e Linux LVM

Disk /dev/sdb: 73.4 GB, 73406611456 bytes
128 heads, 32 sectors/track, 35003 cylinders
Units = cylinders of 4096 * 512 = 2097152 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 35003 71686143+ 8e Linux LVM
-------------------------------------------------------------------

[root@wolfdev03 ~]# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [68.25 GB / 32.00 MB free]
PV /dev/sdb1 VG VolGroup00 lvm2 [68.34 GB / 68.34 GB free]
Total: 2 [136.59 GB] / in use: 2 [136.59 GB] / in no VG: 0 [0 ]
-------------------------------------------------------------------

[root@wolfdev03 ~]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [58.22 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [10.00 GB] inherit



Thanks,

Gulam.

Everyday Learning.
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Add new disk using LVM on RedHat AS 4.0

Shalom Gulam,

after pvcreate

Either

vgcreate a new volume group.
vgcreate -n newvg /dev/sdb1
lvcreate -L 30 GB newvg
mkfs.ext3
mount

You got a filesystem to use.

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
Gulam Mohiuddin
Regular Advisor

Re: Add new disk using LVM on RedHat AS 4.0

I get the following error:

[root@wolfdev03 ~]# vgcreate VolGroup01 /dev/sdb1
Physical volume '/dev/sdb1' is already in volume group 'VolGroup00'
Unable to add physical volume '/dev/sdb1' to volume group 'VolGroup01'


Thanks,

Gulam.
Everyday Learning.
Ivan Ferreira
Honored Contributor
Solution

Re: Add new disk using LVM on RedHat AS 4.0

As pvscan reports, sdb is already in a volume group, so:

1. Create new Volume Group VolGroup01 using (/dev/sdb1).

Not possible/needed, sdb already in a volume group.

2. Create new Logical Volumes LogVol01 (30GB) & LogVol02 (30GB) in new VolGroup VolGroup01.
3. Make two volumes of 30 GB each.

LogVol01 already exists, use a new logical volume name. Let's say, LogVol02 and LogVol03.
lvcreate -n LogVol02 -L 30GB VolGroup00
lvcreate -n LogVol03 -L 30GB VolGroup00

4. Format the new volumes.

mkfs -t ext3 /dev/VolGroup00/LogVol02
mkfs -t ext3 /dev/VolGroup00/LogVol03
tune2fs -i 0 -c 0 -m 0 /dev/VolGroup00/LogVol02

tune2fs -i 0 -c 0 -m 0 /dev/VolGroup00/LogVol03

5. Mount them on /u02 (30GB) and /u03 (30GB).

mkdir /u02
mount /dev/VolGroup00/LogVol02 /u02
mkdir /u03
mount /dev/VolGroup00/LogVol03 /u03

6. FSTAB entires.

Copy/paste another fstab entry and correct the device and mount point fields.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Hemmetter
Esteemed Contributor

Re: Add new disk using LVM on RedHat AS 4.0

Hi Gulam

if you want to create VolGroup01 with /dev/sdb1 first you have to
$ vgreduce VolGroup00 /dev/sdb1
then
$ vgcreate VolGroup01 /dev/sdb1


rgds
HGH
Gulam Mohiuddin
Regular Advisor

Re: Add new disk using LVM on RedHat AS 4.0

Do I need to take VolGroup00 offline in order to reduce it or extend it?

Thanks,

Gulam.
Everyday Learning.
Hemmetter
Esteemed Contributor

Re: Add new disk using LVM on RedHat AS 4.0

Hi Gulam,

no you do not need to take volumegroup offline neither for reducing nor for extending.

Just make sure no LE of /dev/sdb1 is used:
PV /dev/sdb1 VG VolGroup00 lvm2 [68.34 GB / 68.34 GB free]
looks good for me.

rgds
HGH
Gulam Mohiuddin
Regular Advisor

Re: Add new disk using LVM on RedHat AS 4.0

Thanks everybody for your prompt help.

This job is done.

Thanks,

Gulam.
Everyday Learning.