Home Page › Forums › Network Management › ZeroShell › Installing ZeroShell in Hard Disk › Reply To: Installing ZeroShell in Hard Disk
August 28, 2012 at 9:54 am
#45148
Member
Hello all. Here my way to install ZS2.0 on HDD. Root folder is located on Hdd
Boot from your favorite liveCD linux (I’ve used knoppix 6.7) and execute the next steps:
- Install ZS2.0 in the usual way, as described here or on http://www.zeroshell.net/eng/documentation/
Then you must delete 2nd and 3rd partitions (all except 1st boot partition) and create your own partitions (ext3 and ext4 fs are supported) - Create tmp folders:
mkdir sda1
mkdir sda2
mkdir usb
mkdir iso
mkdir rootfs.dir
mkdir initrd.dirand mount partitions to it:
in my case HDD was /dev/sda, usb flashdrive – /dev/sdb and ZS2.0RC1 livecd iso image filename is ZeroShell-2.0.RC1.iso. You can find out flashdrive device name using dmesg or fdisk -l commandsmount /dev/sda1 sda1
mount /dev/sda2 sda2
mount /dev/sdb1 usb
mount -o loop usb/ZeroShell-2.0.RC1.iso iso - Copy all files and directories from previously mounted iso image to sda2:
copy -arp iso/* sda2
rm -f sda2/isolinux - Unpacking rootfs to hdd:
gunzip -c iso/isolinux/rootfs > rootfs
mount -o loop rootfs rootfs.dir ##mount unpacked rootfs ext2 image
cd rootfs.dir
find . -maxdepth 1 -type l -delete ##Deleting softlinks
cp -arp ./* ../sda2
cd ../
- Also we need to edit sda2/etc/fstab:
/dev/sda2 / ext3 defaults 1 1
/dev/sda1 /boot ext2 defaults,ro 0 0
proc /proc proc defaults 0 0
none /sys sysfs remount 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
usbfs /proc/bus/usb usbfs defaults 0 0 - modification of initrd.img
gunzip -c sda1/initrd.img > initrd.dir/initrd
cd initrd.dir
cpio -id < initrdEdit initrd.dir/init script (I wrote only changed strings here):
## if [ "$root" = ISO ] ; then
# echo "Mounting ISO image ..."
# mkdir /cdrom
# if mount "$device" /cdrom 2>/dev/null ; then
# echo -n "Loading root filesystem into RAM device... "
# if gzip -dc /cdrom/i#solinux/rootfs >/dev/ram2 2>/dev/null ; then
# echo Success
# umount /cdrom
# #/sbin/insmod /lib/loop.ko
mount $device /.root
cd /.root/dev
ln -sf $device cdrom
cd /
mount /.root/dev/cdrom /.root/cdrom 2>/dev/null
sleep 3
echo "Successfully mounted device $device"
#umount /cdrom
# else
# echo "Wrong ISO filesystem found"
# umount $device > /dev/null
# while true ; do sleep 10000 ; done
# fi
# else
# echo "Failed to mount the Live CD"
# while true ; do sleep 10000 ; done
# fi
# else
# if ! mount -n -t "$rootfstype" -o "$rootflags" "$device" /.root ; then
# no_mount $device
# cat /proc/partitions
# while true ; do sleep 10000 ; done
# else
# echo "Successfully mounted device $device"
# fi
# fipack new initrd and replace the original with it:
rm -f initrd
find -print | cpio -o -H newc | gzip -c9 > ../sda1/initrd.img
That`s all. Reboot and try ti boot from hdd