Extend a linux Volume

Posted on 2011-10-18
Medium Priority
Last Modified: 2013-11-14
I have two main partitions as below;

Filesystem            Size  Used Avail Use% Mounted on
                      100G   94G 1009M  99% /
/dev/cciss/c0d0p1      99M   13M   82M  14% /boot
tmpfs                  16G     0   16G   0% /dev/shm
/dev/cciss/c0d1       404G  236G  149G  62% /DataDrive

I need to extend the size of the root partition "/" by about 60Gb to accommodate the DB size. Am not sure how to do this without losing or corrupting the data. I have seen some documentation that show with LVM, this is easy to do. But I need a step by step process with no risk.

Please help.
Question by:ackimc
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 36990846

It is easy:
- Just create another disk over your RAID (say /dev/cciss/c0d0p4)
- Execute pvcreate : pvcreate /dev/cciss/c0d0p4
- Execute vgextend  :vgextend /dev/VolGroup00 /dev/cciss/c0d0p4
- Execute lvextend (assuming the new volume is 200Gig) : lvextend +L200G /dev/VolGroup00/LogVol00
- Now you can extend the filesystem using resize2fs : resize2fs /dev/VolGroup00/LogVol00

Here are some documentation:

LVL 21

Expert Comment

ID: 36994879
For future reference, putting your entire disk in the root partition is bad practice, and is just asking for trouble... especially if you have a database running on that machine.
LVL 12

Expert Comment

ID: 37004934
Could you please send me output of below given commands.

fdisk -l

and also let me know if you can put a new disk into the system or you want to use the existing disks to extented the / partision.

Umesh Panwar
LVL 81

Accepted Solution

arnold earned 2000 total points
ID: 37005070
You could migrate the DB data to a new volume which will be an overlay of the partition
i.e. /path/to/db_files
you would copy the data from the db_files to the new volume and then mount it as /path/to/db_files
i.e. pvcreate /dev/newdisk
vgcreate VolGroup2 /dev/newdisk

mkfs.ext4 /dev/VolGroup2/LogVol00
mount /dev/VolGroup2/LogVol00 /mnt
cd /path/to/db_files
find . | cpio -pdvmu /mnt
cd ..
mv db_files db_files.orig
mkdir db_files
mount /dev/VolGroup2/LogVol00 /path/to/db_files
make sure the permissions on the db_files match the permissions on db_files.orig
At which point everything should work and will let you free up space on the / partition while separating out.
LVL 19

Expert Comment

ID: 37020522
I would avoid increasing the size of the root partition and do as arnold says and follow arnolds instructions to create a separate partition for the db data, you can use the du command to give you an idea of how large the partition needs to be.

   du -sm /var


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question