Re: fsck






Thanks! And thanks for the sh recommendation, that easier than what I was going to do...




At 05:21 AM 9/26/2006, you wrote:
tech@xxxxxxxx wrote:
> I've got a /usr partition with some problems. During boot it fails and I'm
> prompted to run fsck manually. I do so and when fsck has finished it asks
> me to run it again, and again, and again...

If that happens, I would assume that the disk is dying. Do
not try to fsck it, because it will probably make it worse.
Instead, use "dd if=/dev... of=... conv=noerror,sync" to copy
the disk to a safe place (i.e. other disk of same size or
larger). Then run fsck there.

> And now for something completely different.... If I can't get the /usr
> partition to work is there any way to recreate the user directories from
> the password file? The contents will be lost but nobody uses their folder
> anyway, I just need all the /usr/home folders created... I could write a
> script, but I thought I'd check first to see if something already exists.......

That's trivial. In /bin/sh syntax:

# cd /home
# awk -F: '$3>999{print $1}' /etc/passwd | xargs mkdir
# for i in *; do chown $i:$i $i; done

That will create home directories for all users whose UID
is greater than 999.

Best regards
Oliver


--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"C++ is the only current language making COBOL look good."
-- Bertrand Meyer

_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Ailing disk
    ... block not found at offset 4108 on hdb1 Aborting journal on device hdb1. ... I therefore unmounted it and attempted to do an fsck on it. ... Never attempt to 'fix' a failing disk by fscking it - that will ... This will make a file copy of your old partition - noerror keeps going ...
    (comp.os.linux.misc)
  • Gaining access to disks made inaccessible
    ... a partition of another much larger hard drive. ... This was cured by fsck but I was hoping to run the machine ... I edited fstab to make the second disk ... could mount the first drive. ...
    (freebsd-questions)
  • Re: off topic - disk crash
    ... You could also use dd with the bs/count operands to skip the bad blocks, ... This will be your recovery disk. ... Repeat 6/7 for each partition. ... This is the more reliable way, but fsck may ...
    (freebsd-hackers)
  • Re: Bad blocks in raid5 disk
    ... On each disk a 20GB partition that is used in a software raid5 ... Tried to fsck the partition but can't. ... There seems to be no fstype suited for checking a 'raid auto' partition. ...
    (comp.os.linux.misc)
  • Re: fsck
    ... I do so and when fsck has finished it asks ... I would assume that the disk is dying. ... The contents will be lost but nobody uses their folder ... Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing ...
    (freebsd-hackers)