Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have deployed two VMs on VMware with CentOS 6.3 Net Install. It has automatically created some partitions. It has created two major partition for root and home. root partition has size of 50GB and home 168GB. root partition has 35GB of free space. I want to resize partitions safely without data loose. server is running CPanel and home partition has important user data. I want to reduce root size and increase to home. home partition has only 7GB used.

Please advise the safest way

share|improve this question
add comment

2 Answers 2

Please show the output of df -h.

If you have LVM installed, you have some reasonable options. If you don't, there's still parted and gparted. But we can't tell you what to do without first understanding the current setup.

share|improve this answer
    
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_linux1-lv_root 50G 19G 29G 40% / tmpfs 1.3G 0 1.3G 0% /dev/shm /dev/sda1 485M 52M 408M 12% /boot /dev/mapper/vg_linux1-lv_home 168G 7.7G 152G 5% /home /usr/tmpDSK 485M 12M 448M 3% /tmp –  Fariborz Navidan Dec 1 '12 at 19:10
    
What happend? Nobody replies. I have LVM installed. Is resizing a LV safe or it can hut data? –  Fariborz Navidan Dec 2 '12 at 14:07
    
Resizing LVM is safe. –  ewwhite Dec 2 '12 at 14:10
    
How do I resize root LVM in rescue mode? It does not detect it. –  Fariborz Navidan Dec 3 '12 at 7:35
add comment

Reposted from: "increase partition size on CentOS 6 or move location of postfix"

If downtime is permissible AND you have physical access AND you have a backup or don't care if this eats your data:

  • reboot into single user mode (or just do telinit 1 from a shell as root)
  • umount /home
  • do resize2fs /dev/mapper/vg_norecordset-lv_home , Make sure this is big enough to hold all your data!!!
  • i.e. resize2fs /dev/mapper/vg_norecordset-lv_home 20g
  • You'll be asked to do a full fsck
  • do lvresize --size /dev/mapper/vg_norecordset-lv_home
  • i.e. lvresize --size 21g /dev/mapper/vg_norecordset-lv_home
  • do resize2fs again without a size
  • i.e. resize2fs /dev/mapper/vg_norecordset-lv_home
  • mount /dev/mapper/vg_norecordset-lv_home
  • you'll be asked to fsck again

This should work but its from memory. I've had to do this a bunch of times but not for a little while.

HTH

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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