Moving a logical partition

I have 40GB unallocated on an extended partition. The partition table from fdisk is


Disk /dev/sda: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6b6ed303

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63     8385929     4192933+  82  Linux swap / Solaris
/dev/sda2         8385930    45303299    18458685   83  Linux
/dev/sda3   *    45303300  1250258624   602477662+   5  Extended
/dev/sda5        45303363    45704924      200781   83  Linux
/dev/sda6       309942108  1250258624   470158258+  83  Linux
/dev/sda7        79263744   184121343    52428800   83  Linux
/dev/sda8       184123392   221874175    18875392   83  Linux

I want to assign the unallocated space to /dev/sda6, but trying to move the partition to the end in Yast I’m told The partition /dev/sda6 is already created on disk and cannot be moved. “Move/Resize” are greyed out in gparted. Am I out of luck?

AFAIK you can only resize a partition if there is unpartitioned space directly after it. So in your case you’d have to delete partitions 7 & 8 to increase partition 6 size. You can accomplish this by:

  1. clone partitions 7 & 8 to another drive,
  2. resize partition 6, making sure you still have unpartitioned space at least equal to 7 + 8 size.
  3. recriate partitions 7 & 8 to at least their original sizes.
  4. restore partitions 7 & 8 from your backup.

Taking a better look at the start/end sectors I see that there is also unallocated space after partition 5, and 6 comes after 8 - I assumed the partitions were in ascending order, which they obviously aren’t, my mistake.
So perhaps you’d have to backup partition 6 also, and recreate all three. I’m not sure if you remove partition 6 and try to recreate it you’ll get a “new” sda6 or a sda9, which might screw your file system hierarchy.

I assumed the partitions were in ascending order, which they obviously aren’t, my mistake.

IMHO fdisk does report this as a warning.
@chief_seath: didn’t fdisk report something like “partitions are not in sequence”?

Yes, it does. This might be a better picture of what I have:

Yes, it does. This might be a better picture of what I have.

http://img85.imageshack.us/img85/2707/screenshotdevsdagpartedk.png

I’ve always used gparted in the past, then the last time I did the partitioning with Yast when I installed 11.3. Now it’s beginning to look like the only option will be to delete everything and start new.

Then tthe next question is of course: why didn’t you post the COMPLETE output of the* fdisk -l *you did? Next time pleae copy/past the complete command/output from and including the prompt until and including the prompt. Thus no interpretation mess can emerge because we then see
. if your are root or not;
. what your CWD is;
. exactly what your command was;
. exactly what the computer answered.
And that all in one simple sweep with your mouse. brunomcl would have loved it without any need for that GParted picture.

I see no need for deleting everything… Why? You do not plan to alter anything in sda1, sda2, sda3 and sda5 aren’t you? thus why destroying them?

In principle the advice of brunomcl is sound. Back up all of sda6, sda7 ands sda8 to some other devices (NOT using* dd or anorther partition saving tool, but a file saving tool like tar or cp*).
Then shutdown openSUSE and do the repartitioning using a live CD and fdisk or a GParted disk if you are used to that.
Then delete sda6, sda8 and sda7 (in that sequence).
Then create sda6, sda7 and sda8 in that sequence and with the sizes you want.
Copy the saved files back ( a live CD is most handy then).
Reboot, should work.

BUT. This is sometthing where you should understand what you are doing. Make a (written down) plan first. A more detailed one then I have painted above (were it only to find where I was to fast and made some glitch).

Apart from that, I have two questions seeing your disk lay-out that might give you soem strain of thought, but that also might be things you know about and thus want them as they are:

  1. what is sda2 for?
  2. why do you mount a file system on* /media*. /media is the place where desktop software normaly mounts storage devices that are connected during the running of the desktop. It does so on directories created for that purpose inside* /media* (e.g/ om /media/SD6498). Not a place to have other data around (mounted or not).

For your questions, henk, sda2 is for dual-booting. And that’s multimedia, not media.

thanks for that.
You probably mean that sda2 is another (Linux) system. That is OK. It is more to get the picture complete.
And for /multimedia, it proves that you must recheck all what I say, because, like everybody, I am not infallable. :shame:

And again, while what you want can certainly be done it is not trivial. I personaly would be able to do it and when you were somewhere in the neighbourhood I would offer to come and help you. There are many more who can do this. But when you are not used to these type of actions, they look eerie and I know they can give you the shivers. You should at least really understand the basics as outlined in SDB:Basics of partitions, filesystems, mount points - openSUSE .

With all respect, henk, I have done this many times and am very familiar with the subject. My mistake was in using Yast instead of the tried and true, and I’ll return to gparted in the future. Yast isn’t a “bad” tool, it’s just laid out so much differently than what I’ve used in the past that it doesn’t seem intuitive and I guess I did not fully realize what I was doing. I’ve only used Yast for formatting and assigning partitions in the past, and I’ll go back to doing it that way.

On 10/29/2011 04:26 PM, chief sealth wrote:
>
> With all respect, henk, I have done this many times and am very familiar
> with the subject. My mistake was in using Yast instead of the tried and
> true, and I’ll return to gparted in the future. Yast isn’t a “bad” tool,
> it’s just laid out so much differently than what I’ve used in the past
> that it doesn’t seem intuitive and I guess I did not fully realize what
> I was doing. I’ve only used Yast for formatting and assigning partitions
> in the past, and I’ll go back to doing it that way.

YaST can do it as well as any other tool, but you do need to understand the
process better than with a GUI tool.

What I would do is back up sda5, 6, 7, and 8, then move sda7 down to reclaim the
unallocated 16 GiB between 5 and 7. Next move 8 down to butt against 7. Next
move 6 down to the end of 8, and finally extend 6 to reach the end of the disk.
There are a lot of operations, and the possibility of a failure are high, thus
the need for the backups.

I want to assign the unallocated space to /dev/sda6, but trying to move the partition to the end in Yast I’m told The partition /dev/sda6 is already created on disk and cannot be moved. “Move/Resize” are greyed out in gparted. Am I out of luck?

Your partition is mounted, run gpartrd from a liveCD. You can resize sda6 to use the free space before it, gpartd will need to move allot of data so give it plenty of time to work, and as always, backup first.

You can?! Did you actually do that? In what file systems?
I’m not being contentious, it’s just that I’ve always heard different, that resizing was only possible to the non-partitioned space after.

You can?! Did you actually do that? In what file systems?

Yes, you can. I have done this many times on ntfs, ext2, ext3, ext4 and fat32.

I’ll try when/if I have an opportunity. Up till now my partitions have all been sequential, and resizing was done mostly to include new partitions after the last one.

But I suspect that if gparted (or whatever app) does this by moving the partition contents to the new beginning, you may get a lot of disk trashing if there’s not enough empty contiguous space (kinda like windows defrag do). It might be faster/better/less weary to the HD to clone the partition to another drive, if one is available.

You can test this easily and safely in vbox. There are precautions that should be taken when doing this on a non test only system, the obvious one that eliminates the risk of disaster is a proper backup. You also don’t want a power supply interruption, although parted has precautions in place for this on some file systems it doesn’t for most.
Moving the start of the root partition in some cases will mean you then need to edit /etc/fstab and /boot/grub/menu.lst.

Having said that, I have found this to be reliable, having done this an estimated 100+ times with only 1 failure due to a power outage, even then because I had a proper backup (which is essential before ANY partition changing operations) it was not an issue.

As noted earlier the procedure can take some time, although I was surprised at how much little extra time was taken when doing this on a close to full partition when I first tried that.

But I suspect that if gparted (or whatever app) does this by moving the partition contents to the new beginning, you may get a lot of disk trashing if there’s not enough empty contiguous space (kinda like windows defrag do). It might be faster/better/less weary to the HD to clone the partition to another drive, if one is available.

Gparted runs a series of short tests to determine the optimum ‘block size’ for the move operation for the current situation and uses that.

That is OK, when you have experience that is great. It is allways difficult to assess the knowledge and experience level of a person when you only see a few posts. And I allways try to be on the safe side before somebody tells me: you told me … and now my system is borked :).

Personaly I would do this using fdisk and have no experience with GParted. I used YaST some times and did not see any difficulties there. I guess you can tell YaST to do the same as with GParted and* fdisk*, but as said I never did a deeper research here. But as long as you know what you are doing use what you think fit.

For the user to do this with gparted on the unmounted partition it is a simple mater of right clicking on sda6 in the list of partitions, choosing ‘Resize/Move’, moving the slider all the way to the left and clicking the apply button. To achieve the same results with fdisk is not a trivial task.

Use the tool that does the job well and makes it easy !