All pastes #586772 Raw Edit

Someone

public text v1 · immutable
#586772 ·published 2007-06-24 00:55 UTC
rendered paste body


here is a possible way to run badblocks inside the installer, it is untested

you need a usb flash disk of at least 20M
with and e2 filesystem on it (has to be e2, fat will bark with hardlinks)

start the computer with install cd in with the usb disk plugged in
this will load the usb modules usb-storage and so on
select linux text and proceed to welcome to centos screen

ctrl-alt-f2 during the install will give you a shell as uid=0

mount the usb disk, there is an apparently unused folder /oldtmp in the root fs, use it for mount point

mount -t ext2 -o rw /dev/sda1 /oldtmp

cp -r /usr/sbin/* /oldtmp

oldtmp now contains what is also in /usr/sbin but you can write to it

cd /oldtmp

note that mke2fs, mkfs.ext2 and mkfs.ext3 all exist, there were hardlinks to same inode in original /usr/sbin
are separate files in copy, it doesn't matter

assuming the installer calls mke2fs lets rename it to mke2fs-bin

mv mke2fs mke2fs-bin

now use an editor to create a script called mke2fs containing

do not use echo "mke2fs-bin -c $1 $2 $3 $4 $5 $6 $7" > mke2fs the parameters will be replaced with nothing
e.g. joe mke2fs

echo "hello I'm the mke2fs script"
mke2fs-bin -c $1 $2 $3 $4 $5 $6 $7


add as many parameter options as might be necessary
you might want -c -k to not test existing known bad blocks

save it


make it executable with chmod a+x mke2fs

cd /

umount /oldtmp

mount -t ext2 /dev/sda1 /usr/sbin

your copy of /usr/sbin now replaces the original one

verify that running mke2fs runs your script by typing mke2fs
you should see 

hello I'm the mke2fs script

followed by usage instructions


carry on with the installation

note you might need to do the same thing for mkswap which also takes a -c option

might not play well with lvm or raid etc.