Jump to content

How to resize my Linux partition?


ianw1974
 Share

Recommended Posts

Summary is that I want to resize my Linux partition. The way my system was configured:

 

(hda1) Windows: 13GB

(hda5) /: 6.4GB

(hda6) Swap: 512MB

 

(this is left to right in the diskdrake utility)

 

Since I found a problem accessing MP3's, large video files, I decided to move the data across to Linux and resize the Windows partition making it smaller. Effectively, I'm going to use Linux a lot more now, and get to a point of dropping Windows almost altogether.

 

I resized my Windows partition, and now the diskdrake looks as follows:

 

(hda1) Windows: 9GB

Spare: 2GB

(hda5) /: 6.4GB

(hda6) Swap:512MB

 

What I want to do, is allocate the spare 2GB and add it to /. I can't do this whilst the system is booted, since the partition is mounted. I can't really use any Windows based resizing utils, since they see my XFS partitions as EXT2, and I know it's likely to get trashed if I use these.

 

What's my best way forward?

Edited by ianw1974
Link to comment
Share on other sites

Probably the easiest thing to do is:

 

1) format the spare space

2) edit /etc/fstab to mount it somewhere specificly in under / - i.e. /var/logs

3) mount it somewhere else temporarily to copy existing information from that location over

4) reboot

Link to comment
Share on other sites

i would try the following: first, backup all important data you have. then throw in your mandrake cd and do a "fake-install". that means, you start the install procedure until you get to the partitioning (alternatively, use a partitioning tool like qtparted from a live cd like knoppix). there you allocate the free partition to your / partition and save it. i don't know if it will need to format the whole drive but it shouldn't do it by default, i guess. after the partitioning is finished, abort the install.

now, you might need a live-cd (knoppix) in order to change your /etc/fstab file. once everything looks okay, you can try a reboot.

 

good luck :)

Link to comment
Share on other sites

I've had a look into it, and apparently since it's XFS I can't use the parted util, since it doesn't support XFS.

 

I'll have a go at the partitioning shortly. Just gotta backup the data on / and then resize and hopefully I won't lose it and have to reinstall!!!

Link to comment
Share on other sites

I just thought I would try this. I booted from the MDK 10.1 OE CD, and when I come to resize, the option is there, obviously since the partition is not mounted.

 

However, I click the resize button, and it then says:

 

After resizing partition hda5, all data on this partition will be lost.

 

I'm obviously thinking, this isn't a good idea, since this is where my whole OS is installed.

 

I've read somewhere about XFS that there is a util to grow the partition, but you can only grow it to space after the partition, and not before. Perhaps this is why the resize option from the MDK CD says it will lose all the data.

 

Is there any other ideas? I don't really want to have to reinstall since it'll take me six hours to get me back to where I am now! (updates from web, etc, etc).

Link to comment
Share on other sites

Things can get very messy here. First I wonder why you only have 2GB spare when you reduced Windows by 4GB. You can create a partition there (which will probably be called hda7) and mount it as /home. You will obviously have to move the data from you /home directory currently stored on hda5. Tha should be no big deal. Then when that is done you can rremove the /home directory on hda5. Make sure all the /home stuff is on hda7 (the new partition). That will free up 2GB on hda5 that you can use for whatever. You will obviously have to edit /etc/fstab (which is on hda5) to mount /home on hda7. You can do this from the rescue on cd1 by mounting your partitions and use vi to edit /etc/fstab. This, I believe, woiuld be the safest approach. Your partitions will then be (as ordered on the disk) hda1, hda6, hda5, hda7, with hda1 =windows, hda7=/home,hda5=/, and hda6=swap.

Link to comment
Share on other sites

Cool, thanks for that, I'll give that a go. I wasn't sure if I created a partition before it, that it would try to become hda5 and cause me further probs.

 

In answer to your question about the 4GB, I previously decreased by 2GB, and then 2GB the other day, which was why I forgot to mention this! So the space is OK.

 

If I create the Home partition, migrate everything across, and edit fstab before rebooting, will that save me having to use the rescue feature?

Link to comment
Share on other sites

Found I can't do that either. As soon as I create the partition /home before / it wants to rename them all. Basically what happens is:

 

/home = hda5

/ = hda6

swap = hda7

 

Since hda6 used to be hda5, I'll have problems booting the system, won't I?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...