Initial state: Fedora 17. LVM: /boot, /root, /home, /swap. Unallocated space - 0.
Finish state: Fedora 17 + Windows 7. LVM: /boot, /root, /home, /swap; NTFS: C:\. Unallocated space - 0.
What we need to get it: cd/dvd/usb images of Fedora X live cd, desired windows pack and GParted
If your fedora partition scheme was automatical as in my case and you don't know how labeled your lvm volume groups and logical volumes you can use system-config-lvm tool to get extensive knowledge about your filesystem. As far as I know it exists in fedora repositories of version 17. To resolve this problem first of all we need to repartition our initial system, so we will have some unallocated space for NTFS. The easiest way to do this is to use GParted live usb/cd/dvd to boot debian live and deactivated your main vg_group (in my case it is looked like similar to this screenshot):
In my case this is a bit different picture where I have /boot on /dev/sda1 and /vg_myvg-group on /dev/sda2.
When you deactivate your partition click resize and free some space (if you have it) for your windows system (~60GB). If you see an error that gparted can't shrink your disk because of /boot part allocated at the last sectors, reallocate doing the following steps:
The error sounds smth like this "... cannot resize extents to ... as later ones are allocated ...". To resolve this error I followed steps from this link
a. to see what extents are currently allocated (find range) open terminal and type (in my case this sectors was /boot located at /dev/sda1):
$:pvs -v --segments /dev/sda |
b. use 'pmove' command to reallocate extents to the beginning of your drive:
$:sudo pvmove --alloc anywhere /dev/device:"extents_range_from - extents_range_to" |
Ok, now you have enough unallocated space for your windows distro and you can start installation. Burn distro with .iso image to your cd/dvd/USB using Unetbootin or other burning tools and setup your windows NTFS file system.
If you get windows installed you might notice at booting that only one available system in bootloader frame exists. Your Grub config was rewritten by new OS and now we need to make new config for dual booting bootloader. Here is a documentation about Grub2. Detailed instruction how to do this you can read here or do the following steps:
1. create dir where you mount you /root and /boot
$:mkdir /mnt/sysimage |
2. Find what is the name of your logical volume /root by using any of these two commands, also check where your /boot placed it is usually 500Mb size separate physical disk, in my case it /dev/sda1 and my volume group with /root and /home on /dev/sda2:
$:lvdisplay $:fdisk -l |
3. Mount your /root logical volume to these mount point:
$:mount /dev/mapper/vg_groupName_lv-root /mnt/sysimage |
4. Mount your /boot linux disk:
$:mount /dev/sda1 /mnt/sysimage/boot |
On this step a possible error is "unknown filesystem type 'LVM2_member". If you can't list your /boot with lvdisplay one of the possible reasons it was corrupted and need to be recovered. To do this follow the next steps (this thread was helpful, /dev/sdaX - /boot location):
$:dd if=/dev/sdaX bs=1 skip=512 count=512 | od -cb $:dumpe2fs /dev/sd $:dd if=/dev/zero bs=1 seek=512 count=512 of=/dev/sdaX $:fsck -y -b "block number from step 2" /dev/sdaX |
If you didn't get superblock number after grep command, write last command as this one:
$:fsck -y /dev/sdaX |
5. Mount critical unix directories:
$:mount -o bind /dev /mnt/dev $:mount -o bind /proc /mnt/proc $:mount -o bind /sys /mnt/sys $:mount -t tmpfs /mnt/tmpfs /mnt/tmp |
6. Chroot to your system image and reconfigure your grub2 config, where /dev/sdX your /boot, in my case /dev/sda1. Or you can reinstall on physical drive as a whole /dev/sda:
$:grub2-install /dev/sdaX $:grub2-mkconfig -o /boot/grub2/grub.cfg $:exit $:reboot |