LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Tool to change partition from primary to extended without prior deleting? (https://www.linuxquestions.org/questions/linux-software-2/tool-to-change-partition-from-primary-to-extended-without-prior-deleting-676188/)

JZL240I-U 10-14-2008 01:21 AM

Tool to change partition from primary to extended without prior deleting?
 
Reason: Solaris mangled the partition table, the old extended partition is now of the type 1f (unknown type) and fdisk refuses to change that back without deleting. Or do I dare deleting and re-creating the old partition scheme by hand, hoping all will be well then?

jiml8 10-14-2008 01:22 AM

run the command fdisk -l and post the results here.

JZL240I-U 10-14-2008 01:26 AM

Right now I'm not in front of the crash victim. From memory it looks now like this: (I changed /dev/hda1 back to linux, /dev/hda2 stayed solaris and I changed /dev/hda3 back to FreeBSD)
Code:

...
/dev/hda4    1f    (unknown)

Extended partitions up to and including /dev/hda9 are gone, of course.

syg00 10-14-2008 01:35 AM

testdisk is very good for this sort of thing. I might be inclined to delete the problem partition and run testdisk, and let it sort out what's what. There can be issues if you have deleted other partitions yourself at some time. You'll have to decide what is valid.

JZL240I-U 10-16-2008 11:03 AM

Thanks syg00, that's what I would have done, if my simpler scheme would not have worked: http://www.linuxquestions.org/questi...5/#post3312333

Still, is there a tool out there which can change a primary into an extended partition and vice versa?

jiml8 you complain in the other thread that I didn't answer your suggestion in post #2, but honestly what more could I post? The information from the relevant partition is rendered in "pseudo" code and the rest explained in the text. Exactly what more is in the direct output of fdisk, what I overlooked to mention? Again I'm not home yet, if it's of use I'll try to do it at the weekend.

syg00 10-16-2008 04:43 PM

Personally I would have thought testdisk was quicker/simpler, but it matters not if you have rectified the situation.
Solaris is a problem child when introduced into a (Linux) multiboot environment - simple as that. Real care needs to be taken - in advance.

As for partitions, an extended is a (form of) primary partition. However, because it is basically a container for (multiple, chained) logical partition(s), the internal structure is significantly different to a single primary partition. Hence you can't simply just change one to the other.
Need I add that backups are always a good idea when screwing around with partitions ???.

JZL240I-U 10-17-2008 01:17 AM

Quote:

Originally Posted by syg00 (Post 3312684)
...Solaris is a problem child when introduced into a (Linux) multiboot environment - simple as that. Real care needs to be taken - in advance.

Hm. How? What needs to be done? Do you have a link to an explanation?

Quote:

Originally Posted by syg00 (Post 3312684)
... As for partitions, an extended is a (form of) primary partition. However, because it is basically a container for (multiple, chained) logical partition(s), the internal structure is significantly different to a single primary partition. Hence you can't simply just change one to the other.

Okay, not from extended to primary without loss of the secondary partitions, understood. But if you know that and maybe get a warning message if you still want to proceed...

What I don't understand is why one can't change primary into extended on the fly. I mean as far as I understand the data in the partition table just get a different meaning, but what the heck, I'm no expert (obviously ;)).

Quote:

Originally Posted by syg00 (Post 3312684)
... Need I add that backups are always a good idea when screwing around with partitions ???

Hrhrhr. I wouldn't have lost anything out of /home, just a lot of work pertaining to the setup of my box.

syg00 10-17-2008 06:02 AM

Not sure there's a link that has all the issues - but it's well documented in bits and pieces.
- you need a primary partition (for Solaris)
- you can't retain your current boot-loader (mmmmm - it had better not be in a logical either methinks)
- you'd better not have more than one swap partition on the disk
...

Been a while since I bothered - I only install it as a virtual guest now. That way it thinks it is the only kid in town, and doesn't screw all my other systems. And when I decide to get rid of it, it's a simple process.

JZL240I-U 10-20-2008 01:31 AM

Quote:

Originally Posted by syg00 (Post 3313283)
...
- you need a primary partition (for Solaris)

Done.

Quote:

Originally Posted by syg00 (Post 3313283)
...
- you can't retain your current boot-loader (mmmmm - it had better not be in a logical either methinks)

Nope. You have to hide everything in GRUB's menu.lst i.e. hide (0,0) up to and including hide (0,3). This means the solaris partition as well. Then you boot it. :rolleyes:

Quote:

Originally Posted by syg00 (Post 3313283)
...
- you'd better not have more than one swap partition on the disk
...

Didn't try, I just have one large one.

Quote:

Originally Posted by syg00 (Post 3313283)
... Been a while since I bothered - I only install it as a virtual guest now. That way it thinks it is the only kid in town, and doesn't screw all my other systems. And when I decide to get rid of it, it's a simple process.

I installed it to learn. And I use my old 700 Mhz Athlon, no virtual solutions possible there...

JZL240I-U 10-20-2008 01:41 AM

@ jiml8 Okay, here it comes:

Code:

Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00041d0d

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          62      497983+  83  Linux
/dev/sda2              63        1308    10008495  bf  Solaris
/dev/sda3            1309        3267    15735667+  a5  FreeBSD
/dev/sda4            3268      30515  218869560  1f  unknown



All times are GMT -5. The time now is 10:13 PM.