LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Building: Own rescue bash-based OS (https://www.linuxquestions.org/questions/slackware-14/building-own-rescue-bash-based-os-851646/)

vit_r 12-21-2010 02:29 PM

Building: Own rescue bash-based OS
 
1 Attachment(s)
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

MS3FGX 12-21-2010 03:58 PM

I'm not really sure what this is...

Jeebizz 12-21-2010 04:03 PM

Seems like reinventing the wheel to me. Just boot the Slackware install disc (CD-1 or DVD), no need to go through all this trouble for a 'rescue disc' when one exists.

linus72 12-21-2010 04:32 PM

You can just use a modified Linux-Live-Scripts + compile kernel with aufs2.1 and squashfs-lzma patches + some slax, etc scripts and you have instant slackware based live distro with cd/usb/hdd persistency
or just use the official DVD or a mixture of both

There are many different existing live kernels you can use from 2.6.33.4 to 2.6.35.7 to 2.6.36.2
and there are already "unofficial" Slackware derivatives like Salix OS that make for great rescue/recovery live media


All times are GMT -5. The time now is 12:46 PM.