Linux partition resizing

Can anyone give some advice on resizing a Linux partition?  I know it can be done with simple fdisk, by changing the parameters, but am not sure what will happen.  Here is the information:

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1               1        1020     8193118+  83  Linux
/dev/hdc2            1021        1542     4192965    6  FAT16
/dev/hdc3            1543        3649    16924477+   5  Extended
/dev/hdc5            1543        2562     8193118+  83  Linux
/dev/hdc6            2563        3582     8193118+   7  HPFS/NTFS
/dev/hdc7            3583        3607      200781    7  HPFS/NTFS
/dev/hdc8            3608        3632      200781    7  HPFS/NTFS
/dev/hdc9            3633        3649      136521   82  Linux swap

I want to change the 8 gig primary Linux to 16 gig, eliminate /hdc5 thereby, and am not sure of the effects on A.)  the extended partitioning  B.)  the NTFS partitions in the extended region.

This look fairly dangerous to me and I'm not sure what the results will be.  I could, of course, copy everything except the first Linux partition somewhere else and fdisk the whole thing, if that is the safer way to go.  I don't want to lose the Primary Linux partition because too much has been built on it and rebuilding it or reinstalling it could take a year.

The FAT16 and the three NTFS partitions, as well as the second 8 gig Linux partition can be temporarily stored on another disk.  I'm also not sure of what will happen if the swap partition is changed, removed and reinstalled or whatever.  The one thing that must be preserved is the primary Linux Partition.
LVL 12
Who is Participating?
Hi GinEric,
You're going to have difficulty doing what you want to do I'm afraid.

Disk partitions need to be contiguous on the disk, so you couldn't have a single partition with some data on one part of the disk and the rest on another.
That essentially means you'll have to remove the partitions and put them back again - which you need to do a backup and restore for.
As a matter of interest, why do you want to have one 16Gb partition?  You could mount hdc5 and use it "as if" it was just in the root partition the other one.

As an aside, it might be worth looking at Logical Volume Manager - which could well help you with this.

Any help?
1. I would not play around with partitions without having a full backup of the system
2. extending the /hdc2-partition and add /hdc3 to it's space should not be to much of a problem. just make sure that the new ending cylinder is at maximum 2562 (so that you are sure you dont touch the other partitions).
3. To actually make this sure, you should only resize using a utility where you can give the size directly in cylinders (not in MB)
4. as you have some HPFS/NTFS-Partitions on there I suppose you do have some WinXP/2000 on the same machine. If you do have PartitionMagic, this could be a nice program to achive it (must be more or less current though, so that it really supports all those different kinds of Linux-Partitions).
5. If you can't do it by Partition Magic, but do it with some partitioning utility, then you need to create a new filesystem onto that new partition, even if the starting cylinder is the same It may look like that's not needed, but then it will also not reconize the additional space. Under Solaris there is a command called "growfs" that would increase the filesystem to match the new size of the partition, but I'm not sure if there is such a util under linux too (especially as I don't know what version of linux you use)
oh, forgot to mention, but mybe clear anyway.... if you create a new filesystem on this new partition, you'll loose the data that was stored there -> do backup / copy away data first
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

First of all, there is no reason to buy partitioning software.  There is a free tool to do this called "Parted".  If you download one of the myriad "live" distributions of Linux (i.e. Knoppix) you can boot up from the live CD and run parted to fiddle around with your disk any way you see fit.

One thing to keep in mind with regards to parted, or any other partitioning tool, you can only resize, delete, move, and create partitions.  I don't believe any of them give you the ability to re-order the partitions you already have, nor to they let you change filesystem types.  As long as your desires fall within those parameters, then you should be fine.
GinEricAuthor Commented:

That is pretty much what I was thinking.  The reason for doing so was, or is, that there is a lot of development on the first Linux partition, and it has eaten up space incredibly fast.  I too thought that using /dev/hdc5 was the answer.  I was just not sure how to make it part of the root partition system.  If I move the source compiles to it, they will most likely break.  However, this is what I was considering:

"You could mount hdc5 and use it "as if" it was just in the root partition the other one"

except that I'm not quite sure how to accomplish that.

Making way for new drives and new servers as well, with much bigger base hard drives.  It won't be a problem with them, however, it is a problem with this one.  There are two other hard drives and a CDR and DVD on the same server.  Each drive has an OS, or two, Linux and/or Windows.  /dev/hda1 and /dev/hdb1 are similar to /dev/hdc1 except that one is FAT, one is NTFS, and their subpartitions are combinations of FAT, NTFS, and Linux.

None are XP, they are at most NT Server 4.0 SP6a.

I have pretty much abandoned/deprecated Windows except on workstations, i.e., I have had enough of Windows Servers; that's all I can stands and I can't stands no more!

neteducation and ChastityMan

I was going to do it manually with Linux fdisk, rather than use any program because I can't predict their results and usually cannot fix them.  I've changed cylinder addresses before and found I could always just rewrite them back if it didn't work.  However, playing with the primary Linux partition is very dangerous, and backing it up really requires copying the whole thing to another disk.

This box is on Slackware 10 currently, and part of its use is to develope Slackware, and other Open Source software.  I do have XP on other machines.  Mixing XP and above with Linux on the same box is maybe a future experiment, I feel I just can't trust XP not to try and break the Linux partitions currently.

What's really in the way is the extended partition.  I know I can't cross that boundary without problems.

I'm going to split the points.  scampgb was closest to my own thinking on the problem.  I hope that is acceptible with all.

GinEricAuthor Commented:
Thanks to all of you.  You have all been very helpful.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.