LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cant resize partition (https://www.linuxquestions.org/questions/linux-newbie-8/cant-resize-partition-669800/)

ceantuco 09-14-2008 12:42 AM

cant resize partition
 
Hi Guys,

I have a 160GB hard disk(sda) which is partitioned like this:

*Primary
- sda1 4.8GB NTFS /windows/C

*Extended
- sda5 63.4GB NTFS /windows/D
- sda6 2.0GB swap
- sda7 19.4 /
- sda8 29.2 /home

(sda5 had a 93.4GB partition but I used Gparted to resize it to 63.4GB)

I have 30GB unallocated. What I am trying to accomplish is use the 30GB unallocated to resize sda8 from 29.2GB to 59.2GB but I tried using gparted, qparted and Partition Magic and they only let me resize sda1, sda5 and sda6 I can not resize sda7 or sda8.

can anyone please help me?
thanks

ronlau9 09-14-2008 01:16 AM

You,re unallocated space is as I assume between sda6 an sda5 you give it to partitions above so to sda5 and sda1
Any how this my understanding how it works
Swap you can nearly always change it

jschiwal 09-14-2008 01:34 AM

If you tried to do this on a live system, then you wouldn't be able to move the swap partition until after running "swapoff". You could run "swapoff" to turn of the swap device and then delete it. Recreate it in it's new location. Moving the root partiton down wouldn't be possible on a live system. If you were running gparted off a live distro, you may be able to move the root partition /dev/sda7 down to it's new location. If not, see if you can create a copy of the partition there. If you can create a copy, then after the copy is created, delete your old root partition. Now the 30GB hole is before the /home partition. If gparted or YaST2's disk partition doesn't move the beginning of the /home partition, there is still room to create a copy of it in the hole and then afterwords delete the original /home partition. Use the copy in its place. The 30GB hole is now after the new /home partition and there will be no problem resizing it.

You may need to perform cloning operations on there own, to completion before going to the next step.

Another Way:
If you have an external drive, consider using it as a backup device for the files in the root and /home partitions. Then delete the swap, root and /home partitions and repartition the hard drive. Copy the files back from the backups you created. Be sure to use the -a (archive) option for cp to preserve the timestamps, ownership, links, and to copy recursively (-a is the same as -dpR).

Yet Another Way:
You might even consider using dd to create exact images of each of your partitions /dev/sda7 and /dev/sda8. Then you will be able to delete the swap, sda7 & sda8 partitions and recreate them in there new locations. For /dev/sda7, you could copy it's bit image replacing your new /dev/sda7. You would need to make the new root partition (sda7) the exact same size as it was before. Next partition and format your new /dev/sda8 (/home) partition. Mount the image file of sda8 (using the loop option) and copy the files from inside your image file backup onto the new and enlarged home directory.

---
Since you are not changing the number or order of the partitions, you will not need to make corrections to /boot/grub/menu.lst or /etc/fstab. If you were running Lilo, you would need to rerun liloconf to save the new start and end locations of the kernel.

Good Luck!

ceantuco 09-14-2008 08:49 AM

wow it sounds pretty complicated. :(

yancek 09-14-2008 10:43 AM

Post the output of 'fdisk -l' so we can see your actual partition structure. What is your extended partition? sda2? You only list one primary and four logical so...? I would assume the extended is sda2? Also, you don't indicate where on the drive the unallocated space is, between partitions? end of drive? Makes a big difference.

ceantuco 09-14-2008 11:05 AM

hello,

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8a47a88b

Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 7 HPFS/NTFS
/dev/sda2 638 19457 151171650 f W95 Ext'd (LBA)
/dev/sda5 638 8923 66557263+ 7 HPFS/NTFS
/dev/sda6 12843 13104 2104483+ 82 Linux swap / Solaris
/dev/sda7 13105 15639 20362356 83 Linux
/dev/sda8 15640 19457 30668053+ 83 Linux

I have to reboot my machine to run gparted live and see where the unallocated space is. I will do it in 5m.

ceantuco 09-14-2008 11:14 AM

the unallocated space is between /dev/sda5 (ntfs) and /dev/sda6 (swap)
thanks!!!

jschiwal 09-14-2008 01:23 PM

If you run gparted from a live distro, and don't activate the swap partition, you may be able to move sda6, sda7 and sda8 and resize sda7. I thought you indicated that you couldn't do it with gparted.

Since you don't need to save anything on the swap partition, you could delete it and recreate it just above sda5. Then gparted may allow you to move the others.

ceantuco 09-14-2008 01:30 PM

the partition that I'm trying to resize is dev/sda8. can I do it as explained above?

jschiwal 09-15-2008 05:09 AM

You have partitions between the unallocated space and the partition you want to resize. You need to move them as well.

In gparted, right click on /dev/sda6 and select "resize/move". Drag it to the left. If gparted lets you move it, great. If not, it's just a swap partition. Delete it and create a new on just after /dev/sda5. Next right click on /dev/sda6 and select "resize/move". Drag it to the left as well. Then do the same with /dev/sda7. Lastly right click on /dev/sda8 and select "resize/move". Drag it to the left and increase the size to include the unallocated space. Click on "Apply all options".

ceantuco 09-15-2008 10:50 AM

Thanks jschiwal. I will def give it a shot tonight!!!

moshebagelfresser 09-15-2008 01:29 PM

You might be able to resize partitions using Partition Magic through Windows. But sometimes this cannot be done as you are notified this partition was not created with it.

ceantuco 09-16-2008 07:59 AM

ok jschiwal, I was able to resize my partition!!! :) however now my Grub doesn't work! It was kinda late last night to try to repair the Grub I would give it a shot tonight. First issue is fixed! now I have a bigger partition!
Thanks for your help! :)

yancek 09-16-2008 09:19 AM

If you've re-sized and moved partitions they may have different names (sda5, sda6??) so justrun fdisk -l again to see what your partitions for Linux are.

ceantuco 09-16-2008 09:31 AM

yes, /dev/sda6 ext3
/dev/sda7 ext3
/dev/sda8 swap

everything else is the same. maybe I have to re-configure Grub.


All times are GMT -5. The time now is 05:30 AM.