resize root partition

Issues related to hardware problems
Post Reply
lineshjose
Posts: 2
Joined: 2015/06/19 08:32:43

resize root partition

Post by lineshjose » 2015/06/19 08:38:53

I've four Partitions

Device Boot Start End Blocks Id System

/dev/sda1 * 1 32 256000 83 Linux
Partition 1 does not end on cylinder boundary.

/dev/sda2 32 4112 32768000 83 Linux
/dev/sda3 4112 5156 8388608 82 Linux swap / Solaris
/dev/sda4 5156 60801 446970400+ 83 Linux

"/dev/sda2" is my "/"(root) partition with 32GB. I want to resize the this partition to 400GB. How can i do this.

Please help me.

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: resize root partition

Post by TrevorH » 2015/06/19 13:12:47

Depends on your experience level with linux. If you are a newbie then you should know that this is a difficult task, made more difficult by the fact that you are not using LVM for your filesystems. Here are the basic steps:

Shrink the filesystem on /dev/sda4 to be the size you want and then move it (use gparted). If using xfs then you cannot shrink the filesystem so you will need to back up the data, delete the partition, recreate it smaller and in the correct location so that the freespace is between /dev/sda3 and /dev/sda4, make a new filesystem on it, restore the data.

Turn off swap, delete /dev/sda3 and recreate it next to /dev/sda4 so that the freespace is now between /dev/sda2 and /dev/sda3. Use mkswap to make it a swap area again, check /etc/fstab for the swap entry and if it uses UUID or LABEL then make sure that this correctly reflects the new /dev/sda3.

Now you can reisze /dev/sda2 using gparted and resize the filesystem on it.

If you were using LVM then this task would be much easier but there is no easy way from where you are now to using LVM.

You might find it easier to reinstall and set things up the way you want them in the first place.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: resize root partition

Post by aks » 2015/06/20 06:33:26

You could use http://gparted.org/

lineshjose
Posts: 2
Joined: 2015/06/19 08:32:43

Re: resize root partition

Post by lineshjose » 2015/06/20 07:19:44

Hi,

Thanks for your reply :) I'm new to centos(Linux). This is my web server. I only using terminal(SSH) to access this server.
So how can fix this issue?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: resize root partition

Post by TrevorH » 2015/06/20 11:37:50

It's almost certain that if you do not have local console access to this machine then you cannot do what you want to do unless you can somehow boot a rescue disk.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

drk
Posts: 405
Joined: 2014/01/30 20:38:28

Re: resize root partition

Post by drk » 2015/06/21 03:52:23

lineshjose wrote:So how can fix this issue?
Put your data in sda4 and create a symbolic link to it.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: resize root partition

Post by aks » 2015/06/22 18:52:43

Boot to rescue mode.

Post Reply