Clé USB Backtrack3 save

Un article de Backtrack-fr.

Sommaire

[modifier] Introduction

Pour ce tutorial je vais installer BT3 sur un flash disk de 2gb. Vous pouvez aussi l'appliquer sur un disk plus grand ;). Je recommande au minimum 2gb.

Maintenant commençons.

[modifier] Download

Ouvrez un terminal et tapez :

 wget http://www.remote-exploit.org/cgi-bin/fileget?version=bt3-usb

Une fois le fichier obtenu, placez le dans un répertoire de votre choix.

[modifier] Partionnement

Nous aurons besoin de séparer notre disque de  2GB en 2 partitions. Une partition sera de 1.10 GB's en FAT32, et la seconde sera en Ext 3.

Je vais utiliser les commandes suivantes pour définir les partitions "fdisk, mkfs, & fsck".

Insérez votre stick usb et créons les partitions.

Ouvrez un terminal et tapez les commandes suivantes:

fdisk /dev/sdb

Vous aurez besoin des privilèges ROOT pour la plupart des commandes que vous allez utiliser

Voici le fdisk prompt:

Command (m for help):

Pour lister les partitions existantes, tapez "p" et enter

Command (m for help): p
 
Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1  *            1         132     1060258+  b  W95 FAT32
/dev/sdb2             133         242      883575  83  Linux

Vous aurez besoin de supprimer ces partitions, aussi tapez "d" et enter Le système vous demandera quelle partition vous voulez supprimer.

Command (m for help): d
Partition number (1-4):

Tapez "1" et pressez enter, maintenant répéter la procédure pour la partition restante.

Une fois qu'il n'y a plus de partition, la commande "p" affichera :

Command (m for help): p 
Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

  Device Boot      Start         End      Blocks   Id  System

Pour créer une nouvelle partition tapez "n" et enter. Ceci va nous afficher quelques détails:

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

Créons la seconde partition Je sais que la première partition devrait être FAT32, on s'occupera de ca plus tard

Retapez "n" et répondez aux questions.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (133-242, default 133):
Using default value 133
Last cylinder or +size or +sizeM or +sizeK (133-242, default 242):
Using default value 242

Regardons maintenant le résultat. Tapez "p" et enter.

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         132     1060258+  83  Linux
/dev/sdb2             133         242      883575   83  Linux

Il est temps de changer l'ID de la partition 1 afin qu'elle corresponde au système de fichier FAT 32.

Tapez "t" et répondez aux questions:

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Nous avons seulement besoin de changer la partition 1 car la 2 est déjà en Ext 3.

Nous allons donc maintenant rendre la première partition bootable.

Tapez "a" et saisissez le numéro de la partition que vous voulez rendre bootable. Dans notre cas, ce sera le 1.

Command (m for help): a
Partition number (1-4): 1

Un denier contrôle avant de le faire, donc tapez "p" et enter:

Command (m for help): p 
Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         132     1060258+   b  W95 FAT32
/dev/sdb2             133         242      883575   83  Linux

Tout semble parfait, nous allons donc écrire les changements. Tapez "w" et enter

Ecriture du système de fichier

Pour cette tache nous allons utiliser la commande "mkfs"

Au prompt, saisissez :

user@laptop:~$ mkfs -t vfat /dev/sdb1

Ceci devrait renvoyer :

mkfs.vfat 2.11 (12 Mar 2005)

Et pour la deuxième :

mkfs -t ext2 /dev/sdb2

Ceci devrait renvoyer :

mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
56896 inodes, 226918 blocks
11345 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=234881024
7 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
       32768, 98304, 163840

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

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

Il est temps d'utiliser "fsck" pour contrôler le système de fichier

Au prompt, saisissez :

fsck -y /dev/sdb1

Ceci devrait renvoyer :

fsck 1.40.8 (13-Mar-2008)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dev/sdb1: 0 files, 1/264543 clusters

Ensuite :

fsck -y /dev/sdb2 

Ceci devrait renvoyer :

fsck 1.40.8 (13-Mar-2008)
e2fsck 1.40.8 (13-Mar-2008)
/dev/sdb2: clean, 11/55328 files, 6071/220893 blocks

C'est fait, les partitions sont créées, le système de fichier est en place et fiable. Nous sommes prêt pour débuter l'installation.

[modifier] Installation

"cd" pour vous placer dans le répertoire ou vous avez téléchargé le fichier rar de BT3 et nous allons l'extraire avec "unrar".

unrar x bt3b141207.rar

Vérifiez quand même que "unrar" soit installé sur votre distribution.

Une fois l'extraction finie, nous allons commencer à copier les fichier sur notre disque. "cd" dans le répertoire de l'extraction et copiez les répertoires "boot" et "BT3" sur la première partition de votre flash drive.

Saisissez :

cp -r boot /media/disk

Ensuite :

cp -r BT3 /media/disk

Si votre disque n'est pas monté dans /media vous devrez spécifier le chemin ou votre disque est monté.

Maintenant "cd" dans la première partition du flash drive.

Saisissez :

cd /media/disk

"cd" dans le répertoire boot et ensuite dans le répertoire syslinux.

cd boot/syslinux

Ici nous allons devoir changer quelques permissions.

Saisissez:

chmod 777 lilo

Ensuite :

chmod 777 syslinux

Utilisez votre éditeur de texte favori pour modifier le fichier "syslinux.cfg" file. Ici nous allons utiliser nano.

nano syslinux.cfg

Changer les lignes:

LABEL pchanges
MENU LABEL BT3 Graphics mode with Persistent Changes
KERNEL /boot/vmlinuz
APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/slax/slaxsave.dat autoexec=xconf;kdm

Par :

LABEL pchanges
MENU LABEL BT3 Graphics mode with Persistent Changes
KERNEL /boot/vmlinuz
APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/dev/sdb2 autoexec=xconf;kdm

You can add this line to any of the boot choices, as it is you will need to boot to "BT3 Graphics mode with Persistent Changes" for the changes to be saved

Nous allons revenir au répertoire précédent et lancez le script "bootinst.sh"

cd ..

Un "ls" devrait nous montrer ceci :

bootinst.bat  bootlilo.sh  dos        isolinux  mt86p     vesamenu.c32
bootinst.sh   chain.c32    initrd.gz  modules   syslinux  vmlinuz

Lancez le script bootinst.sh :

./bootinst.sh

Ceci démarre le Slax boot installer:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                        Welcome to Slax boot installer
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This installer will setup disk /dev/sdb1 to boot only Slax. 

Warning! Master boot record (MBR) of /dev/sdb will be overwritten.
If you use /dev/sdb to boot any existing operating system, it will not work
anymore. Only Slax will boot from this device. Be careful!

Press any key to continue, or Ctrl+C to abort...

Hit any key and:

Flushing filesystem buffers, this may take a while...
Setting up MBR on /dev/sdb...
The Master Boot Record of  /dev/sdb  has been updated.
Activating partition /dev/sdb1...
No partition table modifications are needed.
Updating MBR on /dev/sdb...
Setting up boot record for /dev/sdb1...
Disk /dev/sdb1 should be bootable now. Installation finished.

Read the information above and then press any key to exit...

Attention, voici des choses importantes à faire ou retenir :

1 / Vous devez sur votre partition de sauvegarde des modifications créer un dossier "changes" tels que /dev/sdb2/changes, sinon sa ne marchera pas !

2/ /dev/sdb1 ou /dev/sdb2 ont de grande chance de devenir /dev/sda1 et /dev/sda2 , par conséquent il vous faut modifier le boot en conséquence, il est tout a fait possible de modifier après que vous l'ayez déjà fait.



L'installation a parfaitement réussi !!!

[modifier] Test

Rebootez votre machine et testez votre stick


[modifier] Freeze à l'étape "Looking for data directory"

Si le boot se fige et/ou que votre lecteur cd-rom fait le DJ à l'étape "Looking for data directory". Rajouter ceci en option de lancement "bt3 from /dev/sdb1" juste après "root=/dev/ram0" (Changer sdb en sda selon votre boot).


Exemple: initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 bt3 from=/dev/sdb1 rw changes=/dev/sdb2 autoexec=xconf;kdm


PS: Pour éviter de répéter l'opération à chaque fois, n'hésitez pas à éditer "/dev/sdb1/boot/syslinux/syslinux.cfg"

[modifier] Liens

http://forums.remote-exploit.org/showthread.php?t=14486&page=3