Operating System - Linux
1831458 Members
3235 Online
110025 Solutions
New Discussion

extending partition on linux

 
SOLVED
Go to solution
Edwin Ruiz_2
Super Advisor

extending partition on linux

How can i extend one linux partition on redhat linux? i have one of 5 GB and i want 15 GB. Pls. help me
11 REPLIES 11
Mark Grant
Honored Contributor
Solution

Re: extending partition on linux

This could be tricky unless partition magic does this kind of thing. However, you might not need to. If you have the space on your disk to create a new 10GB partition then just create it with "fdisk". Give the new partion a type of 83 and create a new file system on it with "mkfs" and then just "mount" it somewhere on the filsystem where you need the additional space.

I, personally, would suggest you look into using LVM on linux because if you were using volume groups instead of fixed partition, you would be able to just add the new partition to the volume group and extend your existing filesystems onto the new partition.
Never preceed any demonstration with anything more predictive than "watch this"
Steven E. Protter
Exalted Contributor

Re: extending partition on linux

I don't remember what distribution you are using.

With 7.x and above, the graphical linuxconf interface is pretty good for helping you avoid fdsisk or cfdisk.

To be honest in my 6.x days everytime I used those two utilities I ended up destroying the system. That gave me a healthy fear of those utilities though I think they've improved.

The gui will let you umount the filesystem. The n if you have the space, exetending the filesystem is point and click.

A backup is very important in these circumstances. I've personally avoided the need for this issue for two years by doing careful capacity planning.

I agree that LVM is easier for these issues. Thats becasue I'm an HP-UX CSA. The problem is LVM doesn't come with a mirroring tool. It can be used in combination with the Red Hat mirror tools however.

If I had a system that needs frequent disk changes, I'd use LVM. The reason is simple, I know most of the commands by heart.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mark Grant
Honored Contributor

Re: extending partition on linux

If your distribution comes with a funky tool like SEP is describing then I would definately use it. I don't know if mine has one as I never thought it might so never looked.


SEP,

Disapointed to hear you shying away from good old "fdisk" and the super-modern, hyper-fancy GUI that is "cfdisk" :)

Never preceed any demonstration with anything more predictive than "watch this"
Edwin Ruiz_2
Super Advisor

Re: extending partition on linux

I am using redhat 7.2. Thans for information..
Austin Tuan
New Member

Re: extending partition on linux

Not sure if this tool is what you need:
GNU Partd

http://www.gnu.org/software/parted/parted.html

GNU Parted is a program for creating, destroying, resizing, checking and copying partitions, and the file systems on them. This is useful for creating space for new operating systems, reorganising disk usage, copying data between hard disks and disk imaging.


==
My first post here in the forum.
Hello world !
:p
Got a question? Google! Man! :)
Stuart Browne
Honored Contributor

Re: extending partition on linux

Austin, Welcome to the forums. I hope you'll find your stay here fun, and informative.

Edwin, Austin is right; 'parted' is probably the best tool for the job.

Due to the nature of the task however, I would highly recommend taking a backup of the affected file system, regardless of what tool you intend to use.
One long-haired git at your service...
Stuart Browne
Honored Contributor

Re: extending partition on linux

Slightly off typic here... SEP, you played around much with resizing online partitions under LVM?

I've been trying to get it working (with out-of-the-box RH distro's), and having issues :P (funny that).
One long-haired git at your service...
Basil_4
Occasional Contributor

Re: extending partition on linux

Hi Stuart,

I'm not sure exactly what you mean, but extending LVs on HP-UX is a doddle. I'm aware that there is a tool which allows you to do it while the volume is live, but I've not used this. I always have to umount the volume in order to fsextend it.

This means that if I need to extend any system LVs (e.g. /usr), I have to boot into single user mode and do it by hand, but this is not a problem on HP-UX. I have not tried it on Linux though...

Indeed, I've still not tried LVM under Linux. Is it worth the effort for a small personal system? I mainly use RH on a laptop and my broadband router (at home).

Drop me a line if you think I can give you more useful info! ;-)

Happy extending...

Basil.
Mark Grant
Honored Contributor

Re: extending partition on linux

Basil, I have been using LVM on all my home Linux PC's for a couple of years. It's great!

I do find myself resizing filesystems from time to time and I have a huge chunk of free space that doesn't get filled up with junk unless I specifically decide to extend something.

Moving disks from machine to machine works fine too as "vgscan" does exactly what it says on the box :)

The only thing I am a bit wary of is that I don't have my "/" filesystem in an LVM. I just can't believe I won't forget that "/" is LVM one day and attempt something really funky that involves doing something to "/" and breaking it.
Never preceed any demonstration with anything more predictive than "watch this"
Stuart Browne
Honored Contributor

Re: extending partition on linux

Mark, what filesystem type do you use, and have you done any online-resizeing of logical-volumes?

There are patches to allow EXT2 resizing (kernel level), but what about XFS/ReiserFS/JFS ?
One long-haired git at your service...
Mark Grant
Honored Contributor

Re: extending partition on linux

Stuart,

I use reiserfs for all my filesystems except "/" (for the same reasons I don't put it in a volume group) and have had no problems resizing online. Of course, you need to make sure the logical volume underneath is actually big enough :)
Never preceed any demonstration with anything more predictive than "watch this"