1

I have a partition layout like this:

ext:
  linux root
  linux swap
pri:
  windows
pri:
  storage
pri:
  storage

I'd like to change this layout to:

pri:
  linux root
pri:
  linux swap
pri:
  windows
ext:
  storage
  storage

See, the partitions are not moved, only the partition table is changed.

Is there a simple (and fast) way to do it, without moving files and deleting partitions? I'm stuck at converting storage into one extended partition with two logical inside.

I expect only a yes/no answer and a tool which i can man upon. :)

2
  • 2
    Thus must belong on superuser, because I can't imagine someone wanting to do something like this on a server...
    – Zoredache
    Oct 4, 2009 at 10:14
  • 1
    i can imagine someone wanting to do it on a server... i just can't imagine avoiding the arrest afterwards... Oct 4, 2009 at 20:11

3 Answers 3

2

Yes. You can do this with fdisk, although there's no way in hell I'd try it.

2
  • Do you mean deleting all partitions, then re-creating the correct layout by hand?
    – Leonid Shevtsov
    Oct 4, 2009 at 9:12
  • Well yes, in the sense that creating a different partition layout requires, by definition, the deletion of the previous partitions.
    – womble
    Oct 4, 2009 at 9:39
1

Any of sfdisk, GNU parted, or gpart should be able to do this for you if you are really careful. And really any fdisk utility can do this, although it will be a little harder.

The trick here is that the partition table is just a data structure in your MBR. You can change it all you want without effecting the actual partitions (slice, etc) that are on the disk. But! whenever there is a mismatch between what an OS reads in the partition table and what it sees when it reads the disk then you will probably not be able to boot or have other problems.

I'm not sure this could be worth the risk on anything other than a lab machine... be careful and back up the part table or just the whole MBR of this disk before you try this, please!

dd if=/dev/sda of=old_bootsector bs=512 count=1
1
  • you'd probably want to backup a lot more than just MBR -- at least get the VBRs (volume boot record, first sector of each partition) and the extended partition table, wherever that resides Feb 19, 2010 at 2:46
0

Actually I did it with fdisk - after emptying and deleting one primary partition I was able to create an extended partition, then I only had to shift data around.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .