16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Unix</strong> Administration<br />

Compares free block count <strong>with</strong> free block list.<br />

6. Salvage Free List<br />

Only if Phase 5 error.<br />

If any errors occur for root file system <strong>the</strong>n<br />

**** BOOT UNIX (NO SYNC) ****<br />

i.e. do a cold start by pressing restart button.<br />

ncheck -i inode_number /dev/dsk/2s6<br />

There should be a "lost+found" directory for each mounted file system.<br />

mklost+found - creates a "slotted directory"<br />

:<br />

if [ $# -lt 1 ]; <strong>the</strong>n<br />

echo "usage: mklf /path/dirname"<br />

exit 1<br />

fi<br />

if [ -d $1 ] ; <strong>the</strong>n<br />

N_SLOTS=254<br />

cd $1<br />

mkdir lost+found<br />

cd lost+found<br />

i=0<br />

while [ 'expr $i' do -le $N_SLOTS ]<br />

do<br />

>$i # create $i<br />

rm $i<br />

i='expr $i + 1'<br />

done<br />

else<br />

echo "$(1) is not a legitimate directory"<br />

exit 1<br />

fi<br />

/* mklf.c - makes lost+found */<br />

#include <br />

#include <br />

#include <br />

#include <br />

main(int argc, char *argv[]){<br />

int i, fd;<br />

char f_name[128];<br />

if (argc != 3 ){<br />

fprintf(stderr,"usage: mklf /path/dirname /dev/special\n");<br />

exit(1);<br />

}<br />

if ((mknod (argv[1], S_IFDIR|0700, argv[2])) == -1) {<br />

fprintf(stderr, "mklf: can't make directory %s\n", argv[1]);<br />

exit(2);<br />

}<br />

for (i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!