install backtrack 3 to HD using live CD from the command line

  • Install Backtrack to HD Using Live CD From the command line
    For whatever reason, I have still been unsuccessful at installing Backtrack to a hard drive by using the installer that they provide. In addition to that, the actual steps (that work) are becoming harder and harder to find online. So I'm going to do my small part in populating the web with one more descriptive and fail safe step by step guide to install BT from the live CD to a HD from the console.
    To begin you will need a hard drive with 2 partitions. One being a swap partition. I'm not sure exactly how Linux decides what to name the storage devices attached to it (perhaps it depends on where it's plugged in, I don't know), but the HD will likely have the name /dev/sda, or /dev/hda, or /dev/hdb, etc. With this being said, let's start now.
    -Power the machine on and boot from the CD, get into the desktop and open a console, then maximize (fullscreen) it.
    -First you need to know what your HD is labeled as. The way I do it is to type "mount", and at the bottom you will see something like "/dev/sda1....". So this shows you that your HD is mounted and is called "sda".
    -We need to set this disk up so unmount it by typing "umount" then the mounted volume name. If /dev/sda1 was mounted, then type "umount /dev/sda1".
    -Now we are going to wipe the drive using "fdisk". Assuming that our disk is called "sda", we will run fdisk on it by typing "fdisk /dev/sda"
    -Two partitions need to be created but before we do so, type "d" to delete any existing partitions and repeat the process until the disk is clean. You can type "p" to view the partition table to verify it's state.
    -Once this is done, we need to create sda1, as our main partition, and sda2, as our swap partition. Before we do this I just need to explain the way I do this. I'm sure there is an easier way or this is not necessary but I do it like this because I create the sda1 first, and then I create sda2 but sda2 I always make 512MB in size. What this means is that I need to figure out how big to make sda1 to leave as close to exactly 512MB of space left for sda2. For example, if your HD is 10GB (10 000MB), then I will make sda1 9488MB in size which will leave close to 512MB for sda2. So figure out the size you will need for your first partition, (in this example my HD will be called "sda" and it will be "10GB" in size). Then follow these steps replacing my "example HD info" with yours, and I will explain in brackets what these steps mean.
    n (new partition)
    p (primary)
    1 (partition name-sda1)
    enter (start sizing at start of disk)
    +9488M (finish sizing partition at 9488MB)
    n (new partition)
    p (primary)
    2 (partition name-sda2)
    enter (start sizing at end of first partition)
    enter (finish using the rest of the space on the disk)
    t (change the type of a partition)
    2 (choose to change sda2)
    82 (code for swap partition)
    w (write partitions to the disk)
    Now that your HD is set up, we can now create the file system and set up all our files from the live CD. Follow these steps.
    1- mkfs.ext3 /dev/sda1
    2- mkswap /dev/sda2
    3- swapon dev/sda2
    4- free (not really sure what this does or if it's even necessary)
    5- mkdir /mnt/backtrack
    6- mount /dev/sda1 /mnt/backtrack
    7- mkdir /mnt/backtrack/boot
    8- cp --preserve -R /{bin,dev,home,pentest,root,usr,etc,lib,opt,sbin,var} /mnt/backtrack
    9- mkdir /mnt/backtrack/{mnt,proc,sys,tmp}
    10-mount --bind /dev/ /mnt/backtrack/dev
    11-mount -t proc proc /mnt/backtrack/proc
    12-cp /boot/vmlinuz /mnt/backtrack/boot
    13-chroot /mnt/backtrack/ /bin/bash (you may recieve an error here but just ignore it if you do and continue on)
    (Now we will configure the lilo.conf file to boot BT properly from the hard drive when you turn the computer on)
    14-nano /etc/lilo.conf
    (Now what I would do is just delete the entire file and just type into it the following: (of course, replacing my HD info with yours unless it's the same anyway))
    #start of lilo configuration file
    boot = /dev/sda
    timeout = 1200
    vga = 791
    image = /boot/vmlinuz
    root = /dev/sda1
    label = Backtrack
    #end of lilo configuration file
    (when your file looks like this, hold "control" and press "x" to exit. Then type "yes" then hit "enter" (or maybe it's the other way around I can't recall at the moment), but you'll see what to do. All that's left is to confirm and write the new lilo file, to do so, continue with these final steps))
    15-lilo -v
    (now sit back and let it reboot, when the CD tray opens, remove the live CD and if all went well, Backtrack should be installed to the hard drive. I hope this helps anyone who uses this guide and if so, great job and enjoy your HD installed BT and if you want to try and spread the guide around as much as you can because every new place a proper step system is posted makes it that much easier and likely that those who are searching for it may find it)