computer tutorial 


DUAL BOOTING WINDOWS XP AND BT2

This method of dual booting will not require you to format the windows part of your hard drive and should not corrupt your current installation in anway. It also presumes that you have one partiton with Windows installed.

Insert the backtrack CD, boot up, log on as normal and 'startx'

Once you are at the desktop open up a terminal window and 'word for word' complete the following (it should take around 30 minutes to complete)

**This will repartition the empty space on your hard drive, so backup your Windows data if you are worried about losing it**

Anything in between the '&' signs are explanations of what you are doing and obviously should not be entered into the command.

If you have SATA hard drives then you will have ‘sda’ in place of ‘hda’ so edit the commands accordingly.

Code:

bt ~ #mount    &This will show you all the partitions BT can see&   
tmpfs on / type tmpfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw,devgid=10,devmode=0666)
/dev/hda1 on /mnt/hda1 type ntfs (ro,noatime)

bt ~ # umount /mnt/hda1/     &We can't make changes to a hard drive that is mounted, so we need to un-mount it first&

bt ~ # qtparted  &start qtparted which we will use to resize the existing partition&


At this point a graphical interface will open to allow you to resize your primary partion (typically your 'C drive')

Highlight /dev/hda on the left - then on the right you will see a rectangle which represents your hard drive. Right click it and select resize, on the new window that opens up drag and drop the right of the green triangle to set the size of the partition you want to give to Windows. I halved it for my system as my Windows install isn’t used for my everyday stuff, so does not need a large amount of space but you can set it to whatever you desire, I would say give at least 8GB to backtrack.

Click OK and then click on the disc icon in the top left (next to the green arrow) this will commit the changes to the disc. You do not have to reboot at this point but I have long ago got into the habit of doing so after making any changes to the hard drive structure.

After you have applied the changes, exit from qtparted and drop back into your terminal window..

You may see something similar to the following, which qtparted logged to your terminal whilst you weren’t looking.

Code:

Warning: Unable to open /dev/hdc read-write (Read-only file system). /dev/hdc has been opened read-only.
No Implementation: Support for opening ntfs file systems is not implemented yet.
No Implementation: Support for opening ntfs file systems is not implemented yet.
No Implementation: Support for opening ntfs file systems is not implemented yet.

Just ignore it and carry on.

Code:

bt ~ # fdisk /dev/hda &Use the fdisk utility to make new partitions on your hard drive (hda)&

The number of cylinders for this disk is set to 7296.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p     &show us the current partitions on the system&

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 5116 41094238+ 7 HPFS/NTFS

Command (m for help): n &New partition&
Command action
e extended
p primary partition (1-4)
p        &We want to create a primary partition&
Partition number (1-4): 2   &give our partition an ID%
First cylinder (5117-7296, default 5117): &just press return&
Using default value 5117
Last cylinder or +size or +sizeM or +sizeK (5117-7296, default 7296): +64M &set the size for the last cylinder in the partition&

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (5126-7296, default 5126):
Using default value 5126
Last cylinder or +size or +sizeM or +sizeK (5126-7296, default 7296): +1024M

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (5251-7296, default 5251): &press return&
Using default value 5251
Last cylinder or +size or +sizeM or +sizeK (5251-7296, default 7296): &press return&
Using default value 7296

Command (m for help): t   &change the partitions system ID&
Partition number (1-4): 3 &change it to 3&
Hex code (type L to list codes): 82   &82 is the code for a Linux Swap partition&
Changed system type of partition 3 to 82 (Linux swap)

Command (m for help): w    &Write the changes ot disc&
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


bt ~ # mke2fs /dev/hda2   &Format hda2 (our second partition) with the ext3 file system&
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
18144 inodes, 72292 blocks
3614 blocks (5.00%) reserved for the super user
First data block=1
9 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


bt ~ # mkswap /dev/hda3   &Make the 3rd partition our swap partition%
Setting up swapspace version 1, size = 1028153 kB
no label, UUID=13e1141d-17f9-4954-8e62-f9705a99d5ba

bt ~ # swapon /dev/hda3   &activate the newly created swap partition&

bt ~ # mkreiserfs /dev/hda4    &format the 4th partition with the reiserfs file system&

mkreiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:
Oleg Drokin was the debugger for V3 during most of the time that V4 was under
development, and was quite skilled and fast at it. He wrote the large write
optimization of V3.

The Defense Advanced Research Projects Agency (DARPA, www.darpa.mil) is the
primary sponsor of Reiser4. DARPA does not endorse this project; it merely
sponsors it.

Guessing about desired format.. Kernel 2.6.20-BT-PwnSauce-NOSMP is running.
Format 3.6 with standard journal
Count of blocks on the device: 4108608
Number of blocks consumed by mkreiserfs formatting process: 8337
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 1Cool
Journal Max transaction length 1024
inode generation number: 0
UUID: f16f721b-a758-4852-a9d3-2964a40a26a1
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
ALL DATA WILL BE LOST ON '/dev/hda4'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/hda4.

Reboot now, when you have started up again open a new terminal window and carry on from here. Pay particular attention to the '/', they have to be entered exactly as shown

Code:

bt #v# mkdir /mnt/backtrack  &create the specified directory&
bt ~ # mount /dev/hda4 /mnt/backtrack/   &sets the mount point for hda4 to the directory we have just created&
bt ~ # mkdir /mnt/backtrack/boot/  &again create the specified directory&
bt ~ # mount /dev/hda2 /mnt/backtrack/boot/   &set the mount point to be the directory we have just created&

bt ~ # cp --preserve -R /{bin,dev,home,pentest,root,usr,etc,lib,opt,sbin,var} /mnt/backtrack  &copies the files recursively to the specified directory - this is in essence installing backtrack to the directory we have specified. As this will copy all the files from the CD it may take up to 20 minutes or so&

bt ~ # mkdir /mnt/backtrack/{mnt,proc,sys,temp}
bt ~ # mount --bind /dev/ /mnt/backtrack/dev/   &remount DEV to the specified mount point&
bt ~ # mount -t proc proc /mnt/backtrack/proc/  &mount the file system type PROC to the specified directory, this allows us to interface with the kernel&
bt ~ # cp /boot/vmlinuz /mnt/backtrack/boot/    &Copy the files and directories to the specified location&
bt ~ # chroot /mnt/backtrack/ /bin/bash         &Change the root path to the specified directory (root on our new partition)&
/dev/pts/1: No such file or directory           &you will get this error, it can be ignored&

Now we need to edit the lilo script to allow us to dual boot the system, this will sit on the first part of the hard drive.

When you boot up this config file is the first thing read and determines which partition will get control of your system, the one with Windows installed, or the one with Backtrack installed

Code:

bt / # nano /etc/lilo.conf

Edit the file to represent the following:

Code:

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
lba32 # Allow booting past 1024th cylinder with a recent BIOS
boot = /dev/hda
#message = /boot/boot_message.txt
prompt
timeout = 1200
# Override dangerous defaults that rewrite the partition table:
change-rules
reset
# VESA framebuffer console @ 1024x768x256
vga = 773
# Normal VGA console
# vga = normal
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
# End LILO global section
# Linux boot partition
image = /boot/vmlinuz
root = /dev/hda4
label = BackTrack2  &you can call this what ever you want&
read-only
# End Linux Boot partition
# Windows bootable partition config begins
other = /dev/hda1
label = Windows XP    &You can call this what ever you want&
table = /dev/hda
# Windows bootable partition config ends

Anything with a # can be removed for brevity reasons if you so wish, I have kept them in to more truly represent the file you will see

Save the file by hitting CTL + X, press Y to save the changes

Code:

bt / # lilo -v      &verbosely write the file to the Master Boot Record - this will overwrite the current Windows MBR and will give you the option to chose your operating system next time you reboot&

LILO version 22.7.1, Copyright (C) 1992-1998 Werner Almesberger
Development beyond version 21 Copyright (C) 1999-2005 John Coffman
Released 17-Sep-2005 and compiled at 00:33:53 on Aug 8 2006.

Reading boot sector from /dev/hda
Using MENU secondary loader
Calling map_insert_data

Boot image: /boot/vmlinuz
Added backtrack2 *

Boot other: /dev/hda1, on /dev/hda, loader CHAIN
Added Windows

Writing boot sector.
Backup copy of boot sector in /boot/boot.0300

Ensure there are no fatal errors here at all - if there are, resolve them BEFORE rebooting. If you do get an error then 9 times out of 10 you will not have edited the lilo.conf file correctly

Code:

bt / #exit
bt ~ #reboot

When your system now starts up you will be presented with the red lilo screen displaying Windows and BackTrack2 (or whatever you put in the 'label =' part of the lilo.conf) obviously select Windows to boot into your Windows OS, or select BackTrack2 to boot into backtrack.

Enjoy :-)



Original Tutorial by Nokia for TheTAZZone-TAZForum

Originally posted on June 14th, 2007 here

Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post...we do not sell, publish, transmit, or have the right to give permission for such...TheTAZZone merely retains the right to use, retain, and publish submitted work within it's Network.