Une collègue d’Ingrid m’a demandé comment résoudre un problème de dual boot. Voici ma réponse !
Q. :> I have installed linux on a usb-lacie drive in my laptop. By following the proposed settings the grub file ended in the lacie, so I’m oblige to connect the lacie to start the computer (despite the fact that starts in windows as first option). I don’t like this. Do you know how can I avoid having to connect the usb-lacie all the time to start the computer ?
R. : Ok, from what you tell me, windows was the first installed.
1)
a) Do you still have the windows installation CDs ? (We won’t need them if everything works according to plan, but it’s to be on the safe side.)
DON’T DO THIS in the beginning, it’s an emergency plan : If your laptop doesn’t reboot, you must boot with the cd (I assume it’s VVVinXP), type "r" for repair when prompted and type "fdisk /MBR" to restore the Master Boot Record of Vindoz.
b) Read all that follows and make sure you have all the tools (command under linux : "dd, mcopy you can manage without that one, ...) (usb key, ...)
c) Have a look at the following url http://www.tldp.org/HOWTO/Linux+NT-Loader.html As I copied and adaptated point 3 & 4 from it.
2) Boot in Linux :
a) login as your normal user and in a terminal type : "df" , you will see some information on how your partitions are occupied.
yves@cerise:~\$ df
Sys. de fich. 1K-blocs Occupé Disponible Capacité Monté sur
/dev/hdb1 20161172 604952 18532080 4% /
varrun 192964 232 192732 1% /var/run
varlock 192964 0 192964 0% /var/lock
procbususb 192964 240 192724 1% /proc/bus/usb
udev 192964 240 192724 1% /dev
devshm 192964 0 192964 0% /dev/shm
lrm 192964 33788 159176 18% /lib/modules/2.6.20-16-generic/volatile
/dev/hdb3 40313996 14690884 23575228 39% /home
/dev/hdb8 10712900 133312 10035388 2% /opt
/dev/hdb5 50394964 7996480 39838528 17% /usr
/dev/hdb6 10080488 933364 8635056 10% /var
/dev/hdb7 20153140 131292 18998108 1% /var/www
yves@cerise:~\$
Take note of the device of the /boot partition (If you don’t see it, It’s under "/" the root partition) It should be something like "/dev/sdaXX" where XX is a number. (I will assume XX to be 2 for the sake of simplicity : So let’s say it’s "/dev/sda2" from now on.)
Your windows disk must be under "/dev/hdaXX" (but maybe you won’t see it if you don’t access it under linux)
b) login as root and type "grub-install /dev/sda2"
#grub-install /dev/sda2
Your windows drive should now be grub free, DON’T reboot now ! (Or you will lose your access to linux.)
3) Now you have to peel the bootsector from your Linux-root-Partition. With /dev/sda2 as your linux-partition, the dd-command is :
# dd if=/dev/sda2 of=/bootsect.lnx bs=512 count=1
Copy the file bootsect.lnx to a floppy or to a USB key to transfer files to the NTFS-Windows-partition.
You can copy it with
# mcopy /bootsect.lnx a:
(on a diskette) or, (if you want to use a usbstick) with
# mount -t msdos /dev/sdb1 /mnt/usbkey
# copy /bootsect.lnx /mnt/usbkey
# umount /mnt/usbkey
(I assume here your usbstick will be put under /dev/sdb1 by the system. Maybe iy will be automagically "mounted"... again use df to probe its existence under linux) (Maybe under SUSE, it’s mounted under /media... I didn’t use SUSE for a long time sorry !)
4) Copy the file from the diskette to C :\\bootsect.lnx. I don’t tell you how to do that.
What lilo.conf is for linux is c :\\boot.ini for Windows NT. Remove the, system- and the read-only-attribute before you can modify it with :
C:\attrib -s -r c:\boot.ini
Now change the file boot.ini with an editor, notepad for example, as follows :
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
C:\BOOTSECT.LNX="Linux"
Only the last line has been added in this example. Restore the attributes after you have saved boot.ini with :
C:\attrib +s +r c:\boot.ini
After a shutdown of your Windows NT and a restart your should see the following :
OS Loader V4.00
Please select the operating system to start:
Windows NT Workstation Version 4.0
Windows NT Workstation Version 4.0 [VGA mode]
Linux
Select Linux and see
grub ...
2004-2024 © @YvesDelhaye.Be : "Nous ne sommes pas faits pour vivre comme des imbéciles, mais pour suivre les chemins de la vertu et de la connaissance." (Dante : l’Enfer) - Tous droits réservés
Ce site est géré sous SPIP 2.1.28 [22259] et utilise le squelette EVA-Web 4.1
Dernière mise à jour : mercredi 1er février 2023