I have a server running RHEL with below hard disks configuration.

[root@localhost indika]# fdisk -l

Disk /dev/sda: 150.3 GB, 150323855360 bytes
255 heads, 63 sectors/track, 18275 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008feb6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1938     5120000   82  Linux swap / Solaris
/dev/sda4            1938       18276   131234816    f  W95 Ext'd (LBA)
/dev/sda5            1938       18276   131233792   83  Linux

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
64 heads, 32 sectors/track, 51200 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8f903139

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       51200    52428784    5  Extended
/dev/sdb5               1       51200    52428768   83  Linux

I am running a MySQL database in /dev/sda5 and now I need to increase the disk capacity for the MySQL database. I have added a secondary hard disk /dev/sdb5 and plan to create a logical volume with /dev/sda5 and /dev/sdb5.

Is it possible to create logical volumes using disk partitions like this. If it is possible is it something that is not recommended.


To proper answer your question, Yes, of course you can aggregate your two drives in one logical volume, BUT you will have to do some additional migration steps.

First of all, prepare your second harddrive to be a LVM PhysicalVolume in short a PV. Second, create a VolumeGroup from this PV, once again in short a VG. Then create a Logical Volume which reside on the VG (size of your needs) and then create a mount point for it (or not, its up to you there.) and format it using your favorite mkfs.FS

Let's continue with your example:

Here we will perform:

pvcreate /dev/sdb5
vgcreate VolGroup00 /dev/sdb5
lvcreate l+(Extends) or L+(Size) VolGroup00 LogVol00


mkdir /databases
mount /dev/mapper/VolGroup00/LogVol00 /databases
mkfs.ext4 /databases

once you've this directory, you take your databases and you put them in it (up to you to perform an hot migration or a manual one with service interrupt).

then, you'll make the same procedure for the /dev/sda5 disk.

fdisk -l /dev/sda5


pvcreate /dev/sda5
vgextend VolGroup00 /dev/sda5
lvextend l+(Extends an int) or L+(Size in MB/GB) VolGroup00 LogVol00

and finally:

resize2fs /databases

it will perform an online resize so sometimes it can fail on old versions of RHEL like the 4.x and some 5.x

so now, if you made a:

df -h

the databases mountpoint will be the size of the LogVol00 that will fit the size you specify during the creation and which is not necessarily the total amount of the VolGroup00.

Big warning, I didn't check the exactitude of the command line for the LV part so double check with command --help before, but it should be ok.

  • I have my boot partition on /dev/sda2. Is this going to be any problem for that. – Indika K Oct 22 '13 at 3:22
  • Should not until you do not screw up. Just be careful of your targeted partition/device for each command and everything should be smoothy. – Dr I Oct 22 '13 at 12:27
  • Thanks for the help. I followed your procedure. But after a reboot there was a problem with the disk. It is a VM and with the help of our IT administrator I reinstalled Linux with LVM configuration. According to our IT administrator the procedure I had followed is correct. But he also was unable to solve the problem without reinstalling Linux. – Indika K Nov 1 '13 at 7:25
  • Oo wooo I never faced a failure on LVM quite strange! What was the error? – Dr I Nov 4 '13 at 12:14
  • Actually it was not possible log in to the VM after reboot. Therefore I was unable to see the error message. It was our IT administrator who reinstalled the system. – Indika K Dec 18 '13 at 17:29

You can create the group with LVM, as mentioned in this guide. However, you can't do this and retain the data unfortunately since both disks need to be formatted for LVM.

  • Just a precision, when you set a disk as a LVM physical volume you actually don't format it but rather only change the partition fanions with the 8e ID and then, when you create a Logical Volume over a VolumeGroup which contain the Physical Volume you format this LV using a specific FileSytem Format ;-) – Dr I Oct 17 '13 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.