Je cherche à réaliser un livecd minimal, sur moins de 16Mo si possible capable de partitionner et formater un disque dur automatiquement.
Cherchant une approche minimale, je ne peux me tourner vers Gparted.

Voici ce que je cherche à réaliser :
- effacer la table des partitions
- créer la parition 1 : primaire 20 Go NTFS
- créer partition 2 : primaire 20 Go NTFS
- le reste du disque est non partitionné
- formatter les partitions 1 et 2


Pour ce faire, j'ai utilisé les éléments suivants :
- image iso de la dernière debian, format business card : debian-506-i386-businesscard.iso
ce cd me servira de base pour démarrer sur le fichier image /install.386/initrd.gz
Ensuite je recréerai un livecd avec isolinux.

Actuellement j'en suis à la phase reconstruction du fichier initrd.gz

Depuis une debian 5.06 installée sur mon disque, j'ai écrit le script suivant :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
#!/bin/sh
 
# Prepare the workspace
mkdir -p $HOME/Workbench/initfs
cd $HOME/Workbench/initfs
 
 
# Create file system structure
mkdir {bin,sys,dev,proc,etc,lib}
 
# Busybox (version used in the initrd from the cd)
cp /mnt/initrd/bin/busybox bin/
 
  # Busybox libraries
  pushd $HOME/Workbench/initfs/lib
  cp /lib/libc.so.6 .
  cp /lib/libm.so.6 .
  popd
 
  # Busybox sym-links
  pushd $HOME/Workbench/initfs/bin
  ln -s busybox ash
  ln -s busybox mount
  ln -s busybox echo
  ln -s busybox ls
  ln -s busybox cat
  ln -s busybox ps
  ln -s busybox dmesg
  ln -s busybox sysctl
  ln -s busybox sh
  popd
 
# Device nodes
mknod dev/console c 5 1
mknod dev/ram0 b 1 1
mknod dev/null c 1 3
mknod dev/tty1 c 4 1
mknod dev/tty2 c 4 2
 
ln -s bin /sbin
 
# parted
cp /sbin/parted sbin/
cp /lib/libparted-1.8.so.10 lib/
cp /lib/libreadline.so.5 lib/
cp /lib/libncurses.so.5 lib/
cp /lib/libdl.so.2 lib/
cp /lib/libdevmapper.so.1.02.1 lib/
cp /lib/libselinux.so.1 lib/
 
# mkfs.ntfs (package ntfsprogs)
cp /sbin/mkfs.ntfs sbin/
cp /usr/lib/libntfs.so.10 usr/lib/
cp /lib/libuuid.so.1 lib/
 
 
 
# Create the /init file
touch init
chmod +x init
echo "#!/bin/ash" >> init
echo "" >> init
echo "mount -t proc /proc /proc" >> init
echo "mount -t sysfs none /sys" >> init
echo "exec /bin/ash --login" >> init
 
 
# jobs
echo "echo \"# Erasing the partition table\"" >> init
echo "dd if=/dev/zero of=/dev/hda bs=512 count=1" >> init
 
echo "echo \"Creating partitions\"" >> init
echo "parted mklabel msdos" >> init
echo "parted mkpart primary NTFS 0 20000MB">>init
echo "parted mkpart primary NTFS 20001MB 40000MB">>init
 
echo "echo \"Formating partitions\"">>init
echo "mkfs.ntfs -f -L \"Systeme\" /dev/hda1">>init
echo "mkfs.ntfs -f -L \"Data\" /dev/hda2">>init
 
echo "echo \"Restarting\"">>init
echo "reboot">>init
echo "">>init

je compresse ensuite ce dossier :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
find ./ | cpio -H newc -o > ../initrd.cpio
cd ..
gzip initrd.cpio
mv initrd.cpio.gz initrd.img
Lorsque je remplace le initrd du livecd par le mien, j'obtiens le message suivant :
Kernel panic - not sysncing: Attempted to kill init!

Si quelqu'un voit comment résoudre mon problème.

Merci d'avance