Extend a linux Volume

Posted on 2011-10-18
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

    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

    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

    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 76

    Accepted Solution

    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

    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Having issues meeting security compliance criteria because of those pesky USB drives? Then I can help you! This article will explain how to disable USB Mass Storage devices in Windows Server 2008 R2.
    The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now