2

I have fedora 26 already installed on a 1tb hard disk which is currently using less than 100gb, and I would like to convert the hard disk to a dual boot with 300 gb allocated to Windows 7. I am comfortable using parted in a bash terminal, but I have never used the parted (resize) command. I already have my data backed up, and I have both a Fedora26 Live (installation) flashdrive and a separate Windows 7 installation flashdrive. I can boot with either flashdrive during a cold boot of my pc, via the F12 key. Shown below are the generic steps that I intend to take, followed by my questions. I request help with these questions.

Steps

 1. Boot from the Fedora 26 Live installation, leaving the 1tb hard disk 
    unmounted.

 2. Within Fedora 26 Live, use lsblk to determine the device name given to the 
    1tb partition.  Then use parted in a bash terminal to resize this partition.
    Shown below is the parted (print) output of the 1tb partition.

    (parted) print                                                            
    Model: ATA WDC WD10EZEX-00W (scsi)
    Disk /dev/sda: 1000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags: 

    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  1075MB  1074MB  primary  ext4         boot
     2      1075MB  1000GB  999GB   primary               lvm

    Assuming that lsblk indicates that the 1tb partition is assigned to 
    /dev/sdb, I plan to execute the following in a bash terminal

    sudo parted /dev/sdb
    < RESIZE COMMAND GOES HERE >
    quit

 3. Still within Fedora 26 Live, quit parted, re-execute lsblk, and then use
    parted on the 300 gb remaining to create a Windows 7 partition.  Assuming   
    that lsblk now indicates that the 300 gb is assigned to /dev/sdc, I
    will then execute the following in a bash terminal:

    sudo parted /dev/sdc
    mklabel msdos
    mkpart primary ntfs 1MiB 100%
    quit

 4. Power off and then cold boot with the Windows 7 installation flashdrive.
    During the installation, select the 300gb (unformatted) partition.

 5. SOMEHOW, install grub on the 1tb hard disk.  My intention is that when I
    hit F12 during a cold boot and select the 1tb hard disk, grub will then 
    present the option to boot into either Fedora 26 or Windows 7.

Questions

a.  Are these the right steps to take, in the right order?

b.  In step 2 above, what is the syntax needed for the resize command?

c.  How do I install and configure grub on the 1tb hard disk?

d.  Should I expect the (now 700gb) Fedora 26 environment to be unaffected, 
    except for the reduced space?

e.  (Slightly off topic) Does the 300gb partition need to be pre-formatted, or 
    flagged as bootable, or will the Windows 7 installation flashdrive handle
    this?
  • 1
    You forgot Step 0 : backup your important data! – PiedPiper Dec 9 '17 at 11:21
  • Can you post the output of lsblk. You appear to be using LV's so parted is not the tool. Also, even if you are not using LV's item 3 is wrong as all partitions on the sdb would be sdbx and not sdc. – bu5hman Dec 9 '17 at 13:42
  • You should also consider that an installation of Windows will create 4 partitions. You'll likely need to replicate this to be successful. – sherrellbc Dec 9 '17 at 15:15
  • To bu5hman : part 1 : very interesting response. Unfortunately, I am not literate enough to understand what you are saying. I'm guessing that LV stands for logical volume. What do you mean by "You appear to be using LV's so parted is not the tool"? I wasn't aware that I was not referring to physical volumes. Under what circumstances is parted not appropriate? Also, I haven't done any of these steps yet, so I don't know what the lsblk output will be like after the 300gb ntfs partition is created. – user2661923 Dec 9 '17 at 17:47
  • To bu5hman : part 2 : I was simply speculating that after booting with a Fedora Live flashdrive and converting the 1tb partition to 700gb, Fedora Live would refer to the remaining 300gb as /dev/sdc. Anyway, I can't easily post lsblk output in a comment. If you still think I'm making a mistake, please re-post your comment as if I was 15 years old. – user2661923 Dec 9 '17 at 17:48
4

a. They are complicated, but I think it should work except for the issues I am going to mention.

b. resizepart. It's an interactive command. Just specify the partition number and the new size. I prefer to use gparted instead of parted myself, though.

c. Within your live booted Fedora, run as root

grub2-install /dev/sda

or replace /dev/sda with /dev/sda1 if you like, but I have never tried /dev/sda1 myself so use it at your own risk.

d. If gparted worked correctly, you should. parted with resizepart should theoretically work but I have not tried it myself

e. You can leave it unformatted and does not need to mark it bootable.

Plus a comment on your 5th step: The grub menu will not automatically update and you'll need to run grub2-mkconfig > /boot/grub2/grub.cfg to update the menu.

However, based on my experience, what is more likely to happen is that the MBR get overwritten by Windows and you may have to invoke the grub2-install command to get your pretty-looking grub menu back.

DISCLAMER: These are based on my personal experience. I have gone through this process many times but that does not guarantee it will work in your case without further problems.

  • Thanks to Weijun Zhou for confronting the major problem, grub. My intention is to skim gnu.org/software/grub/manual/grub/grub.pdf, execute steps 1 through 4, and then re-boot with the Fedora Live flashdrive. At this point, I am hoping that I can (somehow) install the grub software from Fedora Live, and that the grub install will "understand" that the hard disk contains Fedora 26 and Windows 7. I'm deferring "accepting Weijun Zhou's answer" because I would like more grub feedback, especially from experienced grub users. – user2661923 Dec 9 '17 at 17:52
  • I suggest you read multiboot guide at least twice before you start, although that is for Fedora 23. You should pay special attention to section 6.3. – Weijun Zhou Dec 9 '17 at 18:18
  • From my experience, knowing how to chroot from a live image is very important if you have installed Windows and want your Fedora back. – Weijun Zhou Dec 9 '17 at 18:23
1

Your method sounds reasonable but it's very complicated. The probability of failure is high.
You need to make a complete backup of your data and and a Fedora upgrade to 27 is due. It will probably be quicker and easier to repartition your hard disk and install from scratch - first Windows then Fedora 27. The Fedora installation will configure grub for you.

  • Thanks to PiedPiper for a very interesting response. I'm leaving his response "unacknowledged" for the time being, to encourage others to facilitate my original approach, which I prefer. Anyway, his response explains why pertinent internet "tutorials" seem to advise installing Windows first. Strangely, I would expect to find a "grub tutorial" that routinely accommodates my approach in a (presumably) very common situation. – user2661923 Dec 9 '17 at 12:33
  • After skimming grub doc's, I've decided to go with PiedPiper's idea of using a new hard disk, installing windows first, and then installing fedora. As a grub-total-newbie, I think the "re-install fedora" pain is more than offset by the advantage of having Fedora Live automatically configure grub for the dual boot. – user2661923 Dec 10 '17 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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