Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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. :)

share|improve this question

migrated from serverfault.com Oct 4 '09 at 19:39

This question came from our site for professional system and network administrators.

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

3 Answers 3

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

share|improve this answer
    
Do you mean deleting all partitions, then re-creating the correct layout by hand? –  Leonid Shevtsov Oct 4 '09 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 '09 at 9:39

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
share|improve this answer
    
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 –  quack quixote Feb 19 '10 at 2:46
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.