4

My installation is Fedora 18 and Windows 8, and I need room for another system.

I have a very delicate task: I need to move my primary /boot partition inside an extended partition which contains all other system's partitions (home, root and swap). Layout is as follows:

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      718847      358400    7  HPFS/NTFS/exFAT
/dev/sda2          718848    84604927    41943040    7  HPFS/NTFS/exFAT
/dev/sda3        84604928    85628927      512000   83  Linux
/dev/sda4        85628928   883879935   399125504    5  Estendida
/dev/sda5        85630976    92938239     3653632   82  Linux swap / Solaris
/dev/sda6        92940288   197797887    52428800   83  Linux
/dev/sda7       197799936   883879935   343040000   83  Linux

If an image is preferred (it is in portuguese): GParted print screen

I have much more empty space than used space, if needed, as seen in the screenshot, and I also have an external drive with more than 250G free. I want to have boot partition inside the extended, if possible. Fedora by default uses the most possible primary partition quantity, and I want to free one up to install another OS. Another very wanted solution would be to move Windows' partitions inside an exclusive extended partition, as I think Windows' boot partition is not used (I use GRUB as bootloader).

8
  • Use bootstar boot manager star-tools.com/english/index.htm or alternative. Use virtual hdd partition marker in boot sector. Make 15 primary partition.
    – STTR
    Jul 11, 2013 at 4:07
  • @STTR I wouldn't like to lose the ability to use partition managers because I use GParted a lot. And isn't this software Windows-only? It seems shady
    – ranieri
    Jul 11, 2013 at 4:17
  • Bootloader does not need an operating system. Usually bootloader is limited interruptions and functions available in the BIOS. No there is yet operating system).
    – STTR
    Jul 11, 2013 at 4:32
  • GPT + UEFI as variant?
    – STTR
    Jul 11, 2013 at 4:43
  • I don't have access to the BIOS. Using GPT wouldn't mess with Windows or something? I don't want to lose data.
    – ranieri
    Jul 11, 2013 at 4:46

2 Answers 2

1

Linux can boot from a logical partition just fine. There are a handful of partitioning programs that can convert primary partitions to logical partitions and vice-versa, but there are often (perhaps always) limits. The program I'm most familiar with for this task is my own FixParts. I recommend you read its Web page to learn how to use it.

In your case, the major problem is that there's no free space between your /dev/sda2 and /dev/sda3. Thus, you'll need to shrink one of these partitions to create some free space -- just one sector is plenty, but you'll probably have to shrink it by 1MiB. GParted can do this job, but there is a caveat: Windows can be pretty fussy about its boot partition. If you're booting from /dev/sda2, it could be rendered unbootable by shrinking that partition in GParted. Thus, it might be better to do this from Windows. Once there's unallocated space just before /dev/sda3, FixParts should have no problems converting it to a logical partition inside your extended partition.

0

Two possible approaches explored here: shrink /dev/sda2 or nuke /dev/sda1's partition (while leaving its data in tact).

I'm sure there are other options other than these two. I'm just pointing out some approaches.

Why do you want to move the primary partition into the extended partition? I'm going to guess that you're concerned with a limit: The traditional limits on an MBR is 4 partitions. If the /dev/sda3 was moved into an extended partition, then you would accomplish getting around that limit. However, where are you planning to place the Fedora partition? Specifically, what are going to be the "Start" value and the "End" value? You also have another issue to take care of, which is the matter of having enough space available.

From the fdisk report, /dev/sda4 is your Extended partition, which starts at 85628928 which is 2048 before the start of /dev/sda5. So, what this shows is that there is a bit of space at the start of the Extended partition before the first "logical drive" that is inside the Extended partition. Now, your /dev/sda3 starts at 84604928 which is exactly one sector after /dev/sda2 ends at 84604927. So, there is no free space before /dev/sda3 to insert the start of the Extended partition.

This means you basically have two choices: moving the contents of the /dev/sda3 partition, or shrinking /dev/sda2 (by at least 2048) so that /dev/sda2 ends sooner. Simply shrinking is probably a safer task than trying to re-locate a partition. Those are the really dangerous parts of the process. If you can shrink /dev/sda2, then you can adjust the starting sector of the extended partition, which is rather safe to do with some software. (OpenBSD's fdisk is the best I've seen with modern software: Ranish Partition Manager was also great.)

From the picture, it looks like you have "Not Allocated" space after the extended partition.

Actually... there may be a much easier way to handle all this. Do you use the /dev/sda1? Or is it some sort of System Recovery partition that you don't actually use?

If you don't actually use /dev/sda1, you could do this: A) Use OpenBSD fdisk (I'm just rather familiar with this software option.) B) Edit partition 0 (assuming that is the one that starts at 2048, ends at 718847, and is type ID 7). Note: block sizes might be reported differently? If so, compensate with the different numbers, as appropriate. C) Make the following changes to the Partition 0: Start: change from 2048 to 0 End: Change from 718847 to 0 Type/ID : Change from 07 to 00

There, you now have a free spot on the MBR. You can now add a partition, and have it start after 883879935, and use up that 44.29 GB you have at the end of the drive. Your NTFS data will just continue to sit on the disk at 2048. If you ever felt the need to boot from it again, you could edit the MBR to change the partition to start back on 2048, end on 718847, and use Type/ID 07 again. There's really no limit that you can only have partitions (one being the "extended") on the drive. The common limit is just that you can only have 4 such partitions defined by the MBR, so you can only have that many available/active at a single time. But you can flip back and forth at will.

I've done such shenanigans successfully before. Note, however, that some software might do some weird things and try to write to space that isn't in a partition. I'd be particularly wary about Hibernation support (is this a laptop?). Also, my experience with Microsoft System Center Data Protection Manager (backup software) suggests that it stores data in some way other than using a filesystem volume within a defined partition. One nice thing about OpenBSD's fdisk is that you can just modify the boot records, which are changes that can be reverted with enough care. Back in the days when I used MS-DOS more often, Microsoft's FDISK would kindly destroy the first 512 bytes (or was it 2048 bytes?) of data in a partition. If such changes are made to a filesystem volume, that essentially causes data loss which usually renders the entire filesystem volume to be unusable. So the ability to do some tasks safely may depend on what software you are using (as well as how well you know what you're doing, and how careful you are). I wouldn't recommend playing around with any sort of drive resizing/moving, or partition deleting (while trying to leave the filesystem volume in tact) if I didn't already have all important data sufficiently backed up (preferably on a different drive).

One thing you may want to do is to COPY (not MOVE) your existing /dev/sda3 partition. You've got enough free space after /dev/sda7 to store a copy (or even multiple copies). In theory, this could be done with dd (using appropriate values for things like skip=). But if you write to unpartitioned space, you're generally going to need to be extremely careful that you don't let the space be used (written to) by multiple pieces of software. If you're not meticulously keeping track of numbers, you'll probably lose it. (For pretty much this whole post, I'm just writing about what is rather possible. For important data, the only approach that is suitably recommendable is to do a proper backup that saves all important data from everyone on the whole drive.)

I confirm Rod Smith's answer to a question from the comments: Linux systems can boot from extended partitions.

You must log in to answer this question.

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