LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-13-2014, 04:27 AM   #1
TetraAsh
LQ Newbie
 
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
How to Resize CentOS 6.5 Partitions


OK, I have a VPS server CentOS 6.5 , we have 100GB drive space available but when it was provisioned the partitions were setup as smaller partitions.

I'm not confident enough to resize these without some help.
So yeah, Help please!!!!

Preferably I would like to expand
/ -> 10GB
/usr -> 10GB
/var - > 10GB
/home -> 50GB

Below is some outputs that might be useful, I would like a guide of the commands, and maybe a link to some good reading material to let me figure out how this all works cause it seems pretty confusing to me.

Thanks in Advanced


Code:
[root@mx3 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            4.0G  795M  3.2G  20% /
/dev/mapper/vg00-usr  4.0G  1.5G  2.4G  39% /usr
/dev/mapper/vg00-var  4.0G  693M  3.1G  19% /var
/dev/mapper/vg00-home
                      4.0G  233M  3.6G   7% /home
none                  1.5G   64K  1.5G   1% /tmp

[root@mx3 ~]# fdisk -l

Disk /dev/xvda: 100.0 GB, 100000595968 bytes
255 heads, 63 sectors/track, 12157 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: 0xad2b2367

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1         523     4200966   83  Linux
/dev/xvda2             524         785     2104515   82  Linux swap / Solaris
/dev/xvda3             786       12157    91345590   8e  Linux LVM

Disk /dev/mapper/vg00-usr: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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: 0x00000000


Disk /dev/mapper/vg00-var: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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: 0x00000000


Disk /dev/mapper/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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: 0x00000000

[root@mx3 ~]#  cat /etc/fstab
/dev/xvda1      /               ext3    defaults,noatime        1 1
/dev/xvda2      none            swap    sw
/dev/vg00/usr   /usr            ext4    defaults,noatime        0 2
/dev/vg00/var   /var            ext4    defaults,usrquota,noatime       0 2
/dev/vg00/home  /home           ext4    defaults,usrquota,noatime       0 2
#/dev/hdd/data  /data           ext4    defaults,usrquota,noatime       0 2
devpts          /dev/pts        devpts  gid=5,mode=620  0 0
none            /proc           proc    defaults        0 0
none            /tmp    tmpfs   defaults        0 0
[root@mx3 ~]#  pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/xvda3 vg00 lvm2 a--  87.11g 75.11g
[root@mx3 ~]# pvscan
  PV /dev/xvda3   VG vg00   lvm2 [87.11 GiB / 75.11 GiB free]
  Total: 1 [87.11 GiB] / in use: 1 [87.11 GiB] / in no VG: 0 [0   ]
 
Old 10-13-2014, 10:25 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
For the LVM volumes, it's easy:
Code:
lvextend --size 10G --resizefs /dev/vg00/usr
lvextend --size 10G --resizefs /dev/vg00/var
lvextend --size 50G --resizefs /dev/vg00/home
Growing the root filesystem is going to be a lot more painful. To make space, you will have to shrink the LVM physical volume (pvresize --setphysicalvolumesize 75G /dev/xvda3), then shrink the partition itself by 6G and slide it to the end of the disk (and AFAIK gparted won't allow you to move a partition that contains an LVM physical volume), delete the swap partition, resize the root partition and filesystem (gparted will do that for you), re-create the swap partition, and finally run "pvresize /dev/xvda3" to make the physical volume completely fill its partition.

It would be easier and safer to copy the existing /dev/xvda3 to another disk, then delete the existing xvda2 and xvda3 partitions, resize the root partition and filesystem, create new swap and LVM partitions, then use pvmove to move the LVM physical volume back into its new space. Still painful, though.

UPDATE: It appears that a recent enough version of gparted will allow you to resize and move an LVM physical volume, and also your swap partition. That's going to make things a lot easier. You can do the logical volume resizing as above, and then let gparted (booted from separate GParted Live media) take care of the moving and resizing needed to grow your root partition.

Last edited by rknichols; 10-13-2014 at 10:56 AM. Reason: UPDATE
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is it safe to resize my Slackware partitions after removing my Mint 10 partitions? Robert.Thompson Slackware 19 02-18-2011 11:47 AM
Resize Partitions jv2112 Linux - Newbie 5 07-20-2010 05:31 PM
How do I resize partitions? watha SUSE / openSUSE 4 09-28-2006 10:29 PM
Resize Partitions mramos Red Hat 4 09-12-2005 09:32 AM
resize partitions wolfe2554 Linux - General 1 07-05-2004 08:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration