Corrupt filesystem on custom rescuedisk
I have made (or rather tried to make but not succeded) a custom rescue disk based on the image /disks/rescue on CD1 of SuSE Linux 7.3. I unziped the image, mounted a loopback filesystem, copied everything to a temporary directory, deleted some files and added some. Then I created an 8MiB file of zeroes, made an ext2 filesystem on that file, mounted it as a loopback filesystem and copied everything from the temporary directory to this filesystem. I then unmounted it, gziped the file and copied the onto a disk using dd. I had to try and fail a bit to get resulting image small enough to fit onto a floppy so I made a script to automate the process. I have attached the script to the end of this post. The problem is that when I boot using the unmodified /disks/bootdisk image, which I copied to a disk, and my custom rescue disk I get errors. After the boot disk is read I get the menus. I then select "rescue system" and "from floppy" (or at least something like that). I am asked to insert the rescue disk, it is read and it says "remove disk" and an OK button. I press the OK button. At this point I would normally get the login screen. I do when I use the supplied, unmodified rescue image. When I use my custom rescue image I get an error message telling me that e2fsck was run and it not find the filesystem entirely to its liking, specifically the superblock is missing. On a previous occasion, ie. with an earlier version of the rescue disk, which didn't work either, I got error messages telling me some program was respawning to fast. Thinking that something was wrong with my rescue disk I loaded the image back from the disk, gunziped it, mounted it as a loopback filesystem and ran e2fsck. e2fsck reported that the filesystem was OK. I also tried with a minix filesystem on the rescue image i case that's what the program (linuxrc is it?) that loads the rescue sytem expects but got, basically, the same result. Here's my rescue image when I've done a ls -s: 1404 -rw-r--r-- 1 root root 1437278 Dec 1 23:40 tmp/newrescue.gz Here's my "make rescue disk" script: #!/bin/bash #Modifies the SuSE rescue image and produces new image. Make a tmp directory #and cd to it before running this. New rescue image is 'newrescue.gz'. if [ $(mount | grep -c 'rescue.*res') != 0 ]; then umount res fi if [ $(mount | grep -c 'newrescue.*newres') != 0 ]; then umount newres fi if [ $(mount | grep -c 'bigrescue.*bigres') != 0 ]; then umount bigres fi #Mount SuSE disk rescue image and copy files to buffer test ! -d res && mkdir -v res cp /SuSE.7.3.CDs/CD1/disks/rescue rescue.gz test -f rescue && rm rescue gunzip -v rescue.gz mount -v -o loop -t ext2 rescue res test -d tmpres && rm -r tmpres test ! -d tmpres && mkdir -v tmpres cp -dpR res/* tmpres #Mount SuSE CD big rescue image test ! -d bigres && mkdir bigres cp /SuSE.7.3.CDs/CD1/suse/images/rescue bigrescue.gz test -f bigrescue && rm bigrescue gunzip -v bigrescue.gz mount -v -o loop -t ext2 bigrescue bigres #Files to add cp -vdp /lib/*lvm* tmpres/lib cp -vdpR /dev/hda16 tmpres/dev cp -vdpR /dev/hdb16 tmpres/dev cp /sbin/vgscan tmpres/sbin cp /sbin/vgchange tmpres/sbin cp bigres/sbin/insmod tmpres/sbin #Files to remove rm tmpres/usr/bin/basename #rm tmpres/usr/bin/chattr rm tmpres/usr/bin/cpio rm tmpres/usr/bin/cut rm tmpres/usr/bin/diff rm tmpres/usr/bin/du rm tmpres/usr/bin/egrep rm tmpres/usr/bin/fgrep rm tmpres/usr/bin/grep rm tmpres/usr/bin/ftp rm tmpres/usr/bin/find rm tmpres/usr/bin/lsattr rm tmpres/usr/bin/less rm tmpres/usr/bin/mt rm tmpres/usr/bin/sed rm tmpres/usr/bin/telnet #rm tmpres/usr/bin/touch rm tmpres/usr/bin/vim rm tmpres/usr/bin/vi rm tmpres/usr/bin/zgrep rm tmpres/usr/bin/wc rm tmpres/usr/bin/yes #rm tmpres/bin/cp rm tmpres/bin/dd rm tmpres/bin/df rm tmpres/bin/mv rm tmpres/bin/ps rm tmpres/bin/dmesg rm tmpres/bin/pwd rm tmpres/bin/fuser rm tmpres/bin/hostname rm tmpres/bin/gzip rm tmpres/bin/gunzip rm tmpres/bin/ping #rm tmpres/bin/sleep rm tmpres/bin/tar rm tmpres/sbin/hdparm rm tmpres/sbin/hwclock rm tmpres/sbin/ifconfig #rm tmpres/sbin/killproc #rm tmpres/sbin/mingetty #rm tmpres/sbin/restore rm tmpres/sbin/route rm tmpres/sbin/sfdisk rm tmpres/sbin/tune2fs #rm tmpres/sbin/update #rm tmpres/lib/libncurses.so.3.0 #rm tmpres/lib/libncurses.so.3.0.980228 #Make new rescue image test ! -d newres && mkdir newres dd if=/dev/zero of=newrescue bs=1k count=8192 echo y | mke2fs -m 0 -N1000 newrescue #echo y | mkfs.minix newrescue mount -v -o loop -t ext2 newrescue newres #mount -v -o loop -t minix newrescue newres cp -dpR tmpres/* newres ldconfig -r newres du -sh res newres #Cleanup umount res umount newres umount bigres rmdir -v res newres bigres rm rescue bigrescue rm -r tmpres #Zip up and report sizes gzip -fv9 newrescue du -k newrescue.gz /SuSE.7.3.CDs/CD1/disks/bootdisk
Try not using custom options in mke2fs and gzip. The program that tries to load the image may no be smart enough to handle non default options. -- Rafael
On Monday 09 December 2002 17:55, Rafael E. Herrera wrote:
Try not using custom options in mke2fs and gzip. The program that tries to load the image may no be smart enough to handle non default options.
Just tried it. It didn't work. However, I noticed an error message that must have passed me by earlier. "fsck.ext2: Filesystem has unsupported feature(s) while trying to open /dev/ram2" Then there's the bit about corrupt superblocks: "The superblock could not be read or does not describe a correct filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap of ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>" Unsupported features? The SuSE rescue disk, which my rescue disk is based on, uses SuSE 5.3/libc5. The system I use to generate the rescue disk is SuSE 7.3. Is that important? The kernel is the same, version 2.4. I tried "mke2fs -O none", which is supposed to turn off some features if you're going to use the file system with a pre-2.2 kernel, just in case. It didn't work either.
I whould suggest just not passing any option to mke2fs. What you should also look is at the documentation of linuxrc (if that is the program that loads this image). There you may find the appropriate recipe to build one of this images. I've searched for a little and linuxrc may not be it. Possibly the ramdisk kernel option, see: http://www.linuxfocus.org/English/November1999/article124.html Another source of problems may be you floppy drive. If you are like me, never use it, you may want to ensure the image is correctly written to the floppy. Make sure the drive is clean. -- Rafael
First, thanks for responding to my posts. The problems is now solved. It turned out to be, partly, as you suggested: not to pass any options (-9) to gzip for better compression. In addition I had to pass '-O none' to mke2fs. Unfortunatley, it never occured to me to try the two in combination until now because the '-O none' option was rather a stab in the dark on my part. I just tested the rescuedisk with and without this option, together with default gzip compression, just too make sure and it looks like it does the trick.
participants (2)
-
Pantaleimon
-
Rafael E. Herrera