How to recover/reinitialize a trashed /var partition?
Hello, I am writing in the hope that someone can give me a hint of how to either recover or recreate a virgin FreeBSD /var partition in an otherwise (apparently) functioning system. Probably in the process of a drive failure in our hardware raid our /var volume got corrupted (yeah, I know this should not happen... sigh. I now also understand why it is recommended having /var on a separate partition...). I tried running fsck -y on /var after umount-ing it, which gives a segmentation fault (exit on signal 11) some way through the process after displaying ** Phase 2 - Check Pathnames ROOT INODE UNALLOCATED UNEXPECTED SOFT UPDATE INCONSISTENCY ALLOCATE? yes CG 0: BAD MAGIC FILE NUMBER UNEXPECTED SOFT UPDATE INCONSISTENCY Now I wonder - is this beyond repair? I should much like to recover /var, just to be able to have a look at the /var/logs to get an idea what went wrong when. About 3.6GB are reported to be in use by df. - If I cannot recover the /var partition, what is the canonical way of recreating it? I suppose I can run newfs on it, but how do I create the necessary subdir structure with the right file-permissions? Could /stand/sysinstall do that? With many thanks for your help in advance, Yours sincerely, David. Dr David Philip Kreil (`-''-/).___..--''`-._ Research Fellow`6_ 6 ) `-. ( ).`-.__.`) University of Cambridge(_Y_.)' ._ ) `._ `. ``-..-' ++44 1223 764107, fax 333992 _..`--'_..-_/ /--'_.' ,' www.inference.phy.cam.ac.uk/dpk20 (il),-'' (li),' ((!.-' ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to recover/reinitialize a trashed /var partition?
On Thu, Jul 29, 2004 at 01:43:29AM +0100, David Kreil wrote: Hello, I am writing in the hope that someone can give me a hint of how to either recover or recreate a virgin FreeBSD /var partition in an otherwise (apparently) functioning system. Probably in the process of a drive failure in our hardware raid our /var volume got corrupted (yeah, I know this should not happen... sigh. I now also understand why it is recommended having /var on a separate partition...). I tried running fsck -y on /var after umount-ing it, which gives a segmentation fault (exit on signal 11) some way through the process after displaying ** Phase 2 - Check Pathnames ROOT INODE UNALLOCATED UNEXPECTED SOFT UPDATE INCONSISTENCY ALLOCATE? yes CG 0: BAD MAGIC FILE NUMBER UNEXPECTED SOFT UPDATE INCONSISTENCY Now I wonder - is this beyond repair? I should much like to recover /var, just to be able to have a look at the /var/logs to get an idea what went wrong when. About 3.6GB are reported to be in use by df. I'm guessing it's beyond reasionable repair, but I'm not ufs expert. Unless you've got data on there that you really need and didn't have backed up, I'd just rebuild from acratch. - If I cannot recover the /var partition, what is the canonical way of recreating it? I suppose I can run newfs on it, but how do I create the necessary subdir structure with the right file-permissions? Could /stand/sysinstall do that? The short version is: # populate /var /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var # add sendmail bits /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / # create new syslog files /usr/sbin/newsyslog -CC # add a lastlog file /usr/bin/touch /var/log/lastlog I cribbed this from /etc/rc.d/var on current. -- Brooks -- Any statement of the form X is the one, true Y is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 pgpemUGV3dkOJ.pgp Description: PGP signature
Re: How to recover/reinitialize a trashed /var partition?
On Thu, Jul 29, 2004 at 01:43:29AM +0100, David Kreil wrote: I am writing in the hope that someone can give me a hint of how to either recover or recreate a virgin FreeBSD /var partition in an otherwise (apparently) functioning system. If you've still got /usr/obj around from your last buildworld you can boot to single user mode and installworld again. If not, you can use mtree(8) to recreate the hierarchy for /var. This should work: # mtree -deU -f /etc/mtree/BSD.var.dist -p /var You may have to touch/chown/chmod a few files here and there to make sure the appropriate users have permissions to write to/from them. See /usr/src/etc/Makefile for some more information on that. Unfortunately I don't think there is a 'var' target in any of those Makefiles. HTH, Brandon D. Valentine -- [EMAIL PROTECTED] http://www.geekpunk.net Pseudo-Random Googlism: brandon is guy ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to recover/reinitialize a trashed /var partition?
Dear Brooks, Thank you very much for your fast and helpful reply. # populate /var /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var # add sendmail bits /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / # create new syslog files /usr/sbin/newsyslog -CC # add a lastlog file /usr/bin/touch /var/log/lastlog I cribbed this from /etc/rc.d/var on current. This is fantastic, thanks! With best regards, David. Dr David Philip Kreil (`-''-/).___..--''`-._ Research Fellow`6_ 6 ) `-. ( ).`-.__.`) University of Cambridge(_Y_.)' ._ ) `._ `. ``-..-' ++44 1223 764107, fax 333992 _..`--'_..-_/ /--'_.' ,' www.inference.phy.cam.ac.uk/dpk20 (il),-'' (li),' ((!.-' ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to recover/reinitialize a trashed /var partition?
Dear Brandon D Valentine, Thank you for your helpful comments. You may have to touch/chown/chmod a few files here and there to make sure the appropriate users have permissions to write to/from them. See /usr/src/etc/Makefile for some more information on that. Unfortunately I don't think there is a 'var' target in any of those Makefiles. Thanks for the pointer. Yes, shame there is no such target. Considering that folks generally advise putting /var on a separate partition, my kind of bad luck must be quite common. With best regards, David. Dr David Philip Kreil (`-''-/).___..--''`-._ Research Fellow`6_ 6 ) `-. ( ).`-.__.`) University of Cambridge(_Y_.)' ._ ) `._ `. ``-..-' ++44 1223 764107, fax 333992 _..`--'_..-_/ /--'_.' ,' www.inference.phy.cam.ac.uk/dpk20 (il),-'' (li),' ((!.-' ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]