Install Windows Over Linux

Friends, as i already mention on my previous post that today laptops or Desktop of branded company  have preloaded Operating system, so  you must have to make some space or new partition on them  to save your data.
If  Linux is installed in your PC as a preloaded OS, and you don't want to delete that from your computer, but want windows to install over LINUX , then my post really help you.
Some one said its very difficult. and you have to install windows first then install linux like fedora, Red Hat over the windows. But nothing like that. just read my Posting  you will succide 100%.

Lets take a example that Preloaded OS is Fedora Linux ,and you have 25GB Hard disk , It has two partitions like this

1       107M                          /boot
2     24.93G                          LogVol00

logical volume is the default volume on fedora/redhat linux , beceause it is very easy to  manage ( You can easily add and remove partition/ or space within it ).

To install  windows you must make some space out of  logical volume, Please  read my previous post to make some space or new partition in  Preloaded Environment

Shrink LV (Logical Volume ) default Installation group of Fedora/ Red Hat linux    and     Resize Pre loaded Operating system 

After reading it  you are able  make some space to install  windows over it .
If you are trying to install windows server 2003, Vista or any other latest OS of windows, then just boot the CD/DVD and find the free space, and make partition   on it and follow the online instruction, or its documentations

 Rember only choose  free space which you created, to install new OS, otherwise you lost your Linux.  after booting from windows CD, it will display  two partition one is around 100mb, other is  windows fault tolrence don't touch them. Just after these two you see free space, just click on that and make partition

 If you want to install 98, Windows 2000, or XP then may be it not show you any option directly  to create  partition or may be windows XP not boot from its CD then what to do.. don't worry. Just follow these steps, you need windows Xp CD , and a 98 CD..

  • Boot 98 CD with CD Rom Support. when you reach at A: promt then type "fdisk"
          click 'y' to go inside the fdisk when it ask to do so
  • After a screen appear like this 

        just press 4 to display  the forth option"Display partition Information"
  • It will display  information of the partition of your hard disk, also display the status of partition ( active, dos / non dos and total space etc) .

  • see the partition which are active... it show  two partition which are active  then click "escape" button of  keyboard and press 1 to creat new partition

It will ask  "Do you want to give it full space to creat new partition........." press 'y' if you want to give it full space or 'n' to customize the partition size.
  • Now it creat a new partition click  ok "may be it says it will need to restart the window to continue then press "ESC" and go at A:\> and write 'Restart' then restart the PC and boot again with 98 CD with above  step 
  • At A:/>  type fdisk and now press 2 to make your partition active .

and press '3' to make 3rd partition active which u created recently.
now click on "Esc" again "Esc" to come out from Fdisk wizard and write command format c: with switches /q and /s
/q for quick and /s for transfer system file.
A:/>formate c: /q/s
  • It may say that quick format will not done, make it normal format, just press 'y' for yes, and  find your CD Rom drive for windows 98 other then C: like here its E:
Note:- it will alocate a RAM drive after C: drive and after Ram drive you will find your CD ROM drive so don't confuse just check it by typing command 'dir' if it display the directory 'win98' that means it is your CD ROM drive.
  • Now enter command "cd win98"  to change directory and "smartdrv" to install smartdrive
          E:\>cd win98
  • Half of your work is done, now remove CD and insert Windows XP CD,  find their Drive letter and write command 'cd i386' and 'winnt'
       E:\.>cd i386

  •  It will take some time to copy the files and after that it will restart and boot the system give it some time, now nothing to do just follow the steps  on the screen

Note:- Don't format the partition, if it ask to format then just choose the option "Leave partition without format"

After windows Install then Insert your linux CD/DVD and click on Upgrade installation and just rebuilt the boot loader after that both linux and windows will work.

Note:- to know how to get linux back read " Recovering Grub Boot Loader "

If you do step wise then you definetly Install windows over linux, without loosing your preloaded linux .


Shrink LV (Logical Volume ) default Installation group of Fedora/ Red Hat linux

Hi, friends, as I mention on my earlier post that today Linux is also going to popular OS. So the Computer vender generally ships preloaded OS like Vista, LINUX etc to the laptop or Desktop,  and only give a single partition for work on which already system files are Installed  with it they generally hide one partition called recovery Installation . If you get any problem get attacked by virus then with a single button you get back to  your previous stat at which you purchased your PC. But what about your precious data , well it is lost.
If you get Windows as a Preloaded OS then you are very Lucky because you get many stuff or software related to create /resize partition (on internet some are free) , which can make a room ( resize your existing partition and make new partition) to save your data. And by chance you get Linux like Fedora red hat SUSE etc  then you definitely suffer more  for that I already mention what to do,  for detail see my previous Resizing the Preloaded Operating system

Now come to the point If you try to resize the LV partition (Logical Volume) on generally fedora/ red hat  then you has to do some extra command line steps. Don’t worry these are easy as GUI, but you have to do some labor.
 follow these steps for easy configuration:-- 
  • Boot Fedora Installation CD/DVD  at rescue mode

It take some time to go to rescue mode after boot , select keyboard layout and language,  After that it ask you to choose the “NETWORK SETUP” so just skip it because there is no need to setup Network
New  screen appear, which Inform you that  “ The rescue environment will now attempt to find your Linux installation and mount it under the directory  /mnt/sysimage” . Click “CONTINUE ”  

  • If everything is Ok , then you get the screen like this 

after clicking on “ok” you get Bash shell
Now type the “mount” command to see the file system mounted on mnt/sysimage, also use df –h to see the disk usage , write down the results because you really need that when you take next steps like volume used etc
         #df –h

/dev/VolGroup00/LogVol00 is the LV group partition which you have to shrink so write down its size used space etc.Unmount everything under /mnt/sysimage and finally /mnt/sysimage itself. Use the "-l" option for umount if you get complaints about busy devices.
#umount /mnt/sysimage/boot
#umaunt /mnt/sysimage/dev
#umount /mnt/sysimage/proc etc

Now execute command “e2fsck –f” (e2fsck is used to check a Linux
second extended file system (ext2fs))and “resize2fs” with the size till
you want your new LV
#e2fsck –f /dev/VolGroup00/LogVol00
#resize2fs /dev/VolGroup00/LogVol00 3G

Remember one thing LVM allocates space in 32MB chunks by default, the new size must be a multiple of the LVM extent size. Leave 20% free space on the volume so that all the files work well. Don’t shrink full file system.
Now type “lvm” and then execute the command “lvresize”
    Lvm>lvresize –-size 3G /dev/VolGroup00/LogVol00
3G means you want to shrink the partition till it becom 3G, you can use your own value like 20G , 10G as you want.
Now write "exit" and then again "exit". Here you done half of your work. At the LV group you created a free space. If you want only till that step then you leave it here, but if you want to make free space outside the LV group to install other OS then continue.
After writing “exit” at Bash shell system restart, so you have to  boot it into rescue modea gain  as mention above but now skip the step when it says it want to attempt to mount the system in mnt/sysimage directory.

Now you get Bash shell again, activate the LVM by the command “lvm vgchange –a y”
              #lvm vgchange –a y
    • and execute command fsck –fc on /dev/VolGroup00/LogVol00 to update /etc/fstab directory.
             #fsck –fc /dev/VolGroup00/LogVol00
    • If you have knowledge of Linux then there is a swap file system which is created after VolGroup00/LogVol00 that is VolGroup00/LogVol01 , so to make new room you have to first remove it and then again make it after the new LV. Don’t worry you just temporarily removing it
    • Execute command “lvm lvs”  
              #lvm lvs         It shows you the exect size of your swap file say it is 1.59G
             Execute command “lvm lvremove” , “lvm lvcreate” on /dev/VolGroup00/LogVol01
             #lvm lvremove /dev/VolGroup00/LogVol01
             #lvm lvcreat ---size 1.59G –name LogVol01 VolGroup00
             #mkswap /dev/VolGroup00/LogVol01

    Now Check how much you can shrink it by executing the command “lvm pvs”
             #lvm pvs
    Write down the result

    Now you can resize your /dev/sda2 physical volume to final size in between anything 10G to anything between 24.88G .
    Execute command “lvm pvresize”
              #lvm pvresize /dev/sda2 --setphysicalvolumesize 16G
    If command fails then that means your shrinking size is too small because there are still allocated extents other then swap, move it like this.
    Execute command “lvm pvs units s” ‘s’ for sectors it will display the partition size in sectors take note of PSIZE and execute parted to display the partion size in sectors (starting and ending ) and make note of that
    Now here you already free the space within LV group, and shrink the boundry of the lv group, so you have just take start sector of LVM and reduce the end sector to shrink it but make safty mark after 64MB (131072 sectors) .
    • Execute command “parted”
              #parted /dev/sda rm 2 (2 is s/no of partition)  
    • And recreat the partition like this 
             #parted /dev/sda mkpart primary 208845s 40000000s
             #parted /dev/sda set 2 lvm on
             #parted /dev/sda print

    Then execute the commands “fdisk –l /dev/sda” and finally fsck –fc to update /etc/fstab
             #fdisk –l /dev/sda
             #fsck –fc /dev/VolGroup00/LogVol00
    Now you got space as you desire, It’s a example you can put your own values to make your desire partition space .

    I get reference  from these two posts so read these posts if  at any point you not understand

    How to shrink a default install LVM PV to create another partition 

    How to shrink your LVM root volume using rescue mode