LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Resizing my partition (https://www.linuxquestions.org/questions/debian-26/resizing-my-partition-385393/)

microsoft/linux 11-22-2005 12:55 AM

Resizing my partition
 
My HD is split into multiple partitions, my partition table is below
Code:

Disk /dev/hda: 30.0 GB, 30005821440 bytes
16 heads, 63 sectors/track, 58140 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1      29118    14675346    7  HPFS/NTFS
/dev/hda2          29118      37645    4297387+  c  W95 FAT32 (LBA)
/dev/hda3          37645      47335    4883760  83  Linux
/dev/hda4          47335      58140    5446035    5  Extended
/dev/hda5          47335      48498      586341  82  Linux swap / Solaris
/dev/hda6          48498      58140    4859631    b  W95 FAT32

/dev/hda6 is actually ext2. I want to remove hda6, and resize hda3, so I can have more room on my debian install. I have a feeling hda4 is the journalling part of hda3, and I don't know what to do about it. Can someone tell me what I need to do?

syg00 11-22-2005 02:54 AM

Re: Resizing my partition
 
Quote:

Originally posted by microsoft/linux
I want to remove hda6, and resize hda3, so I can have more room on my debian install.
You can't - without significant work.
Quote:

I have a feeling hda4 is the journalling part of hda3, and I don't know what to do about it.
No, hda4 is what it says it is, an extended partition - the container for logical partitions hda5 and hda6. Check the start and end numbers and you'll see what I mean.

Your best solution would be to use hda6 as a mount-point for what is your biggest directory tree - or the one you expect to grow biggest and/or fastest. This can be achived by a simple "cp -a" command and an update to /etc/fstab.

microsoft/linux 11-22-2005 08:38 AM

why is it so difficult to resize an ext3 partition? Couldn't you just move the end point back? That's what I did when I was resizing my windows partition. What about ext3 makes it so difficult?

Wells 11-22-2005 08:49 AM

OK...a couple of problems that I see with your original idea....

First, you have a main partition, then a Windows partition, then a second linux partition. After that, in the fourth partition you have a logical partition which holds two more partitions. Those two partitions are a linux data and a linux swap partition. In order for you to do what you are talking about, you would have to do the following:

1. Wipe out the swap and last data partitions (hda5 and hda6)
2. Wipe out the logical partition (hda4)

At this point, you will only have three partitions left, and unused space from 47335 to 58140. Now you need to use parted or some other program to extend hda3 into this space. This is, of course, assuming that parted is not broken still and can handle ext3 partitions again. If not, you may have to convert hda3 into an ext2 partition, extend the drive, then convert back to an ext3 partition. Yes, even more work, not to mention you are risking the integrity of the data on hda3. Anyways...

3. Extend hda3 using parted. Leave some space at the end so that you can recreate the swap partition, unless you feel that you really don't need it. I find that it is always good to have a little bit of swap space on the system regardless, otherwise things get a little flaky.
4. Create the new swap partition as hda4, then format the partition for swap (mkswap)
5. Edit /etc/fstab to point to the new swap partition, as it has changed in enumeration.

This should do the job. I highly recommend backing up everything that you want to save, just in case something breaks.

microsoft/linux 11-22-2005 09:33 AM

I understand I'd have to remove the swap and hda6(I was building LFS 6.1 on it, but I need more room). Is this the only thing that makes it so difficult? What things should I back up? the whole thing? Other suggestions?

Wells 11-22-2005 09:40 AM

I would back up anything that you do not want to lose, on any of the partitions.

samael26 11-22-2005 09:43 AM

Simple things work best. I suggest backing up your whole linux partitions and
format them afresh so that you can distribute your new partitions as you think
will fit your needs best. Windows is first, so that's ok, just reinstall Debian and
rebuild LFS from scratch. What have you got to lose ?
You can make images of your linux partitions using partimage.
It will work if they are not mounted, so, boot on a Knoppix Cd for instance
to do so.

Good luck !

microsoft/linux 11-22-2005 10:14 AM

I was just going to remove the LFS/swap partitions and move the back end of the ext3 partition back. Will this work? Or should I still back-up, reformat, and then put my stuff back on? Is there a way to back up to CDs? I don't have an extra HD laying around big enough

microsoft/linux 11-22-2005 06:37 PM

bump

microsoft/linux 11-29-2005 09:56 PM

please? noone has any other ideas?

Lokathor 11-29-2005 11:09 PM

http://www.linuxquestions.org/questi...hreadid=362506

First, read that topic. It'll show you how to make partition backups in segments at a time with dd. You can make .iso files and burn those to CD, then copy them back to reassemble the partition later.

Be warned, this mentod is very delecate and so read closely the thread explaining how dd works first.

microsoft/linux 11-29-2005 11:24 PM

the IT person at my old school showed me a way to mirror a drive, essentially tarring and untarring the drive. Is there a way to tar the drive, expand the partition, and then untar it back onto the expanded partition? Is there any reason I can't just move the end point of the partition back(after remove hda6 and swap, and then recreating swap)?

Lokathor 11-30-2005 12:10 AM

well, if you read the description of DD a little farther than just the begining you'd see farther down that it's the same kind of process as tarring an untarring, but without any compression (good topic, i'd suggest it even if you don't use dd in ths situation, the info is helpful to be aware of). Come to mention it, Tar might be a better sollution depending on how much free space you've got left at this point.

syg00 11-30-2005 04:59 AM

It is *never* as simple as "moving the endpoint of the partition back".
Not under Windows, not ever.
Consider how much you pay for the (commercial) software that does this for you, and how much you aren't paying for all the efforts of the people providing you with OSS tools.

Deleting the logicals, then the extended will allow you to resize the hda3 partition. However the filesystem within that expanded partiton will not use anything more than it was initially defined for. Imaging tools (dd and partimage for example) suffer the same limitation once the image is restored to a larger partition than the source.
There are tools to do filesystem resizing for you - some more successfully than others.

Personally I never resize partitions - I always back-up, delete, reallocate (including mkefs), then restore.
In this scenario, tar is an excellent option.
If it all goes to hell, you have the tar as a backup that can be restored almost anywhere - a significant benefit.

microsoft/linux 11-30-2005 08:40 AM

so even if I moved the endpoint back(after deleting the logical partitions/swap), I would still only have 5.0 GB for my install? There's no way just to have it recognize the extra 5GB?


All times are GMT -5. The time now is 03:16 PM.