Post-installation partition modification (dual boot) question

On a Lenovo R400 in which Fedora 39 KDE is installed, occupying all of the 250 GiB SSD divided into two partitions, I find the occasional need to run some DOS applications. Neither DOSBox Staging nor WINE is able to run this software as needed and the Intel Core2 Duo processor does not have VM-X extensions so I am reluctant to build a VM and install DOS on it.

Instead I think the easiest route would be to create a third partition out of unused space and install FreeDOS on that. I believe I could modify GRUB to include the new OS and just boot that directly when needed.

But I’ve never tried reducing a partition on an existing system and I thought I would ask if this seems feasible or whether there are any caveats (other than don’t touch the boot partition).

Suggestions welcome, thanks,

-CH-

This should be very easy to do.
I would suggest that you install gparted and use that to manage the partitions.

Note that you cannot do what you wish (shrink) a mounted partition so you would need to use either the live install media and install gparted in that environment to manage the installed system partition (simplest), or use a live bootable gparted device to do the same.

Thank you for your reply.

Using the Live KDE 39 disk I ran KDE Partition Manager and resized the BTRFS partition to leave 3 GiB separate from the remaining 220. I was then able to create a new partition and specify FAT32 for it, which the FreeDOS docs assured me FD could handle.

Using a FreeDOS Live disk I began the HD installation from an FD boot. The FD install automatically used the 3 GiB DOS partition, not giving me any choice in the matter. The install failed part way through and after some investigation I realized I needed to format and SYS my new partition. From the live boot (again) I ran fdisk to see if it recognized the new partition as FAT32 and set my new partition as Active, then ran format /s and started the install again.

This time the format succeeded and in the end I had a machine that would boot to FreeDOS on startup. However, in the process I had lost access to my Linux installation. I went back into fdisk to change the Active partition flag back to where it had been (on the Linux partition) but fdisk refused to do so as the partition was non-DOS. Hmmm…

Back to KDE Live where from Partition Manager I could change the Active flag (or Boot, in Linux terms) back to where it was , but the machine still would not boot to GRUB. If I made my DOS partition Active it would boot again, but nothing doing with Linux.

I created a gparted Live disk and used that but there was no change in the situation. More research indicated the possibility that GRUB2 had been corrupted, and additionally that my MBR had been encrypted and would need to be decrypted, re-established and re-encrypted in order to make things right.

So that’s where I am at the moment. I’m fairly sure my Linux installation has not been overwritten or reformatted but at the moment I am trying to re-establish access to it.

-CH-

FreeDos most likely overwrote the MBR on the drive so now grub would not exist.

Likely it would have been better to use a VM and install FD into the VM for using dos when needed.

You may need to use a live boot media for fedora and use a chroot environment to recover grub booting.

I managed to recover the installed Fedora 39 KDE Workstation OS and to install a
modified GRUB2 bootloader that gives me the option of booting Fedora
or FreeDOS. I made a number of discoveries along the way and for
use by anyone who might find themselves in a similar situation I will
highlight some of them here.

The essence of the problem was that the FreeDOS Live installer
overwrote the MBR of the hard disk, sda1 as Linux names the
partition, to point to the FAT32 third partition, sda3, where FreeDOS
is installed. Booting from the hard disk went straight to
FreeDOS, in other words. Booting from other, removable media,
however, I found that most of the rest of the Fedora installation was
intact - my /home directory, with all of the work product, for
example. Thankfully I was able to copy this off before setting about
repair.

I used a number of different self-booting ISOs; the KDE Live
installer, a GPARTED utility, a MINT boot-recovery disk; but I found
that the SuperGRUB2 disk
(Super Grub2 Disk) was especially
useful and could actually boot my previous installation by
examining the “core image” that remained in
/boot/grub2/i386-pc/core.img. Although I was unable to restore the
boot track from this utility, I knew the system was recoverable.

The final piece of the puzzle was to rebuild the GRUB2 bootloader and
put it on the MBR. I found in the Fedora Docs the following article:
The GRUB2 Bootloader – Installation and Configuration :: Fedora Docs.
I determined that I was using a BIOS so the procedure was somewhat
simplified, but there is one caveat: GRUB2 can be configured to suit
a number of different situations, and different Linux “flavors”, e.g.
Fedora, Mint, SuSe, Ubuntu etc., may have differing ideas about how
that should be accomplished. In the case of my Fedora installation a
critically important tool was left out of the GRUB2 configuration.

It was necessary for me to edit the file /etc/default/grub to add the
following line, GRUB_DISABLE_OS_PROBER=false, which allowed the GRUB2
configuration-builder to use the os-prober and list the FreeDOS
operating system along with Fedora. I ran grub2-install and
grub2-mkconfig, and rebooted to find a menu of choices including
Fedora and FreeDOS.

I took on this task for the purpose of discovery, and I learned a lot
about both operating systems in the process. I understand that with
flexibility comes complexity, but if I might raise two small
objections they would be these: In the installation process make
clear what choices are being made and how they may affect your
system; get confirmation before you overwrite the MBR. If you can’t
do that in coding, at least put it in documentation. And speaking
of documentation, if you have a custom configuration of a tool such
as GRUB2, please document what you have left in and left out: it was
only on a third-party web site that I learned of the need for
specifying the os-prober.

That’s my saga. Thanks again for your help.
-CH-