Building: Own rescue bash-based OS
Live Linux as initrd( from Slackware's arsenal( unofficial ))
Building: Own rescue bash-based OS
Example, - is sooner a draft or hint( easily changeable )
Slackware 13.1 rescue-like PGS-set
{
60 Mb:
lilo, pkgtools,
c/fdisk, gpm, mc, find, dd,
cd-dvd tools, zips( except rzip ) and so on
}
After installation on logical p7n( 500 Mb; ext2 )
booting and configuring:
{
font, gpm, ..., time,
especially the time, otherwise fsck may..
}
some deletes in /usr:
for example in:
usr/lib/locale, usr/share/locale, usr/share/zoneinfo, usr/share/mc, ...
next dirs can be removed:
var/man, usr/include, usr/doc, usr/share/gtk-doc, ...
next dirs may be removed:
usr/man, usr/info,
because man/info-pages can be read in RAM from hard drive:
- mount /path-to/usr
- mc
- /path-to/usr/man/file.gz
- F3
Creating OS-image( initrd.img ):
~ # cd /
/ # cp etc/rc.d/rc.S etc/fstab root/
To prevent fsck-check of root filesystem while booting to RAM
in etc/rc.d/rc.S( Slackware 13.1 ) is better to delete lines from $LINENO = 131 till 237:
130:# Test to see if the root partition is read-only..
131:READWRITE=no
. . .
236:fi # Done checking root filesystem
237:
We comment in etc/fstab lines which mount any hardware
and leave uncommented next three lines():
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
Some backups:
/ # cp etc/rc.d/rc.S etc/rc.d/rc.S-for-ram
/ # cp etc/fstab etc/fstab-for-ram
CRITICAL:
To prevent kernel panic:
/ # ln -s sbin/init init
Rebooting
Here native Slackware( vmlinuz-huge-smp-2.6.33.4-smp ) should be booted
We mount initrd-p7n than cd /path-to-initrd-p7n/
/path-to-initrd-p7n/ # mv boot /tmp/
/path-to-initrd-p7n/ # [ -L init ] \
&& find . | cpio -o -H newc | gzip -9c > /tmp/boot/initrd.img \
&& echo -e "\n OS-image( initrd.img ) is created\! \n"
Now the omly task is left: to boot initrd.img
Preparing initrd-p7n for booting from hard drive:
/path-to-initrd-p7n/ # mv /tmp/boot .
/path-to-initrd-p7n/ # /bin/cp -f root/rc.S etc/rc.d/
/path-to-initrd-p7n/ # /bin/cp -f root/fstab etc/
We add in lilo.conf:
next line as first line:
large-memory # This allows LILO to use more than the first 15MB of RAM.
and new section:
image = /boot/vmlinuz-huge-smp-2.6.33.4-smp
initrd = /boot/initrd.img
label = ram
read-only
append=" ... " # usual parameters
addappend=" panic=22 ramdisk_size=248124 "
And finally:
/path-to-initrd-p7n/ # chroot .
with next
/ # sbin/lilo && exit
/path-to-initrd-p7n/ # cd
~ # umount /path-to-initrd-p7n/
~ # reboot
On lilo-prompt:
- label 'ram'
LiveCD/DVD-USB is quite obviouse, isn't it?
ps
Extracting:
cat ../initrd.img | gzip -d | cpio --extract -H newc --preserve-modification-time
Good luck
|