Re: Power failure during portsnap fetch update

2012-07-22 Thread Robert Bonomi
 From owner-freebsd-questi...@freebsd.org  Sat Jul 21 09:40:20 2012
 Date: Sat, 21 Jul 2012 16:38:02 +0200
 From: Leslie Jensen les...@eskk.nu
 To: freebsd-questions@freebsd.org
 Subject: Power failure during portsnap fetch update


 My file system /usr/ports/net go damaged

 I've done fsck -F in single user mode but there are warnings about not 
 being able to fix this.

Insufficient Data for a meaningful response.  *sigh*

_Exactly_ WHAT the command line used was, and *WHAT* the exact text of
the error message says is needed before anyone can help.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Wojciech Puchar


I've done fsck -F in single user mode but there are warnings about not being 
able to fix this.


without the messages from fsck i cannot help you.

there are rare cases when mess gets written to inodes that fsck will not 
corrent it and you have to do it yourself. most often - using clri(8).

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Polytropon
On Sat, 21 Jul 2012 16:38:02 +0200, Leslie Jensen wrote:
 
 My file system /usr/ports/net go damaged
 
 I've done fsck -F in single user mode but there are warnings about not 
 being able to fix this.

First of all, you should give fsck a second try. Check the
damaged partition per fsck -y /dev/ad0s1f (which refers
to that partition, e. g. /usr).



 The directories below cannot be removed

That indicates a major file system defect.



 How do I go about this?

There is a nice tool in the base system: clri (clear inode).
Please note that you're going to get your hands dirty
with this approach!

First, determine the inodes of the offending directories.
Use ls -ldi to do this.

Example:

# cd /usr/ports/net
# ls -ldi ccxstream netselect spread vde2
288794 drwxr-xr-x  3 root  wheel  512 2011-08-21 03:14:43 ccxstream/
331753 drwxr-xr-x  3 root  wheel  512 2011-08-21 03:16:10 netselect/
424004 drwxr-xr-x  3 root  wheel  512 2011-08-21 03:17:50 spread/
424104 drwxr-xr-x  2 root  wheel  512 2011-08-21 03:18:04 vde2/

Alternative: You can also use stat to obtain information
about a file (and a directory) and its health.

Example:

# cd /usr/ports/net
# stat ccxstream netselect spread vde2
120 288794 drwxr-xr-x 3 root wheel 1139829 512 Jul 21 16:46:35 2012 Aug 21 
03:14:43 2011 Aug 21 03:14:43 2011 Feb 18 02:04:47 2011 16384 4 0 ccxstream
120 331753 drwxr-xr-x 3 root wheel 1325518 512 Jul 21 16:46:35 2012 Aug 21 
03:16:10 2011 Aug 21 03:16:10 2011 Feb 18 02:04:58 2011 16384 4 0 netselect
120 424004 drwxr-xr-x 3 root wheel 1696620 512 Jul 21 16:46:35 2012 Aug 21 
03:17:50 2011 Aug 21 03:17:50 2011 Feb 18 02:05:15 2011 16384 4 0 spread
120 424104 drwxr-xr-x 2 root wheel 1696720 512 Jul 21 16:46:35 2012 Aug 21 
03:18:04 2011 Aug 21 03:18:04 2011 Feb 18 02:05:18 2011 16384 4 0 vde2

You recognize the inode numbers here. Write down the inode numbers
or store them in a temporary file. You can script this process if
you like. :-)

Then go out of the partition and unmount it. You are safer
if you apply clri to an UNMOUNTED partition.

Then, for example, do this:

# clri /dev/ad0s1f 288794
# clri /dev/ad0s1f 331753
# clri /dev/ad0s1f 424004
# clri /dev/ad0s1f 424104

Note that this directly modifies file system bowels of the
/usr partition! When done, apply fsck again:

# fsck -yf /dev/ad0s1f

Maybe fsck finds some errors in inode construction and will
therefore recover lost data (which we will accept as irrelevant
at this point) into the lost+found/ root directory on that
partition. You can remove its content later on.

If fsck finishes with success, you should be able to mount the
/usr partition again. Of course, some subdirecories in the
ports tree are now missing, but that has been inteneded.

Side note:

You can use the program fsdb to investigate inode information
in detail. See man fsdb and man clri for details.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Leslie Jensen



2012-07-21 16:44, Wojciech Puchar skrev:


I've done fsck -F in single user mode but there are warnings about not
being able to fix this.


without the messages from fsck i cannot help you.

there are rare cases when mess gets written to inodes that fsck will not
corrent it and you have to do it yourself. most often - using clri(8).
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



Here are the errors:


root@bsd01~:fsck -F /dev/ad4s3f
** /dev/ad4s3f (NO WRITE)
** Last Mounted on /usr
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
MISSING '.'  I=5021  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:13 2012
DIR=?

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '.'  I=123745  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:17 2012
DIR=?

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '.'  I=123796  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:20 2012
DIR=?

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '.'  I=169253  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:30 2012
DIR=?

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '.'  I=2571711  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:28 2012
DIR=?

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '..'  I=2571711  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:28 2012
DIR=/ports/net/netselect

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '..'  I=5021  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:13 2012
DIR=/ports/net/ccxstream

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '..'  I=123745  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:17 2012
DIR=/ports/net/spread

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '..'  I=123796  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:20 2012
DIR=/ports/net/spread4

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

MISSING '..'  I=169253  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:30 2012
DIR=/ports/net/vde2

UNEXPECTED SOFT UPDATE INCONSISTENCY

FIX? no

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=5021  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:13 2012  COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

LINK COUNT DIR I=123745  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:17 2012  COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

LINK COUNT DIR I=123796  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:20 2012  COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

LINK COUNT DIR I=169253  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:30 2012  COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

LINK COUNT DIR I=2124226  OWNER=root MODE=40755
SIZE=27136 MTIME=Jul 21 16:32 2012  COUNT 4 SHOULD BE 5
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

LINK COUNT DIR I=2571711  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 21 16:28 2012  COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFT UPDATE INCONSISTENCY

ADJUST? no

** Phase 5 - Check Cyl groups
263573 files, 3718492 used, 6942235 free (204667 frags, 842196 blocks, 
1.9% fragmentation)


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Wojciech Puchar

how about fsck_ffs -y / in single user mode?

seems like no clri is needed.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Polytropon
On Sat, 21 Jul 2012 16:56:28 +0200, Leslie Jensen wrote:
 Here are the errors:
 
 
 root@bsd01~:fsck -F /dev/ad4s3f
 ** /dev/ad4s3f (NO WRITE)
  

In that case, fsck won't correct any errors. Good for checking,
bad for repairing!

Make sure the partition isn't mounted (e. g. right after entering
SUM after a boot -s system start) and run:

# fsck -yf /dev/ad4s3f

This will tell fsck to perform the check anyway (-f) and answer
YES (-y) to all questions regarding file system modification.
If you feel unhappy with this quite brutal approach, leave
out the -y parameter and answer the questions yourself.

The error messages you did show in the form of

 MISSING '.'  I=5021  OWNER=root MODE=40755
 SIZE=512 MTIME=Jul 21 16:13 2012
 DIR=?
 
 UNEXPECTED SOFT UPDATE INCONSISTENCY
 
 FIX? no

and

 MISSING '..'  I=2571711  OWNER=root MODE=40755
 SIZE=512 MTIME=Jul 21 16:28 2012
 DIR=/ports/net/netselect
 
 UNEXPECTED SOFT UPDATE INCONSISTENCY
 
 FIX? no

as well as

 LINK COUNT DIR I=5021  OWNER=root MODE=40755
 SIZE=512 MTIME=Jul 21 16:13 2012  COUNT 1 SHOULD BE 2
 LINK COUNT INCREASING
 UNEXPECTED SOFT UPDATE INCONSISTENCY
 
 ADJUST? no

show that the inodes of several directories have been damaged.
This perfectly fits your observation of not being able to
remove those directories.

You _need_ to repair the file system in order to proceed. First
let fsck try to do its job. If it fails to do so, attempt to
manually repair the inodes (by removing them altogether).




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Leslie Jensen



2012-07-21 16:59, Wojciech Puchar skrev:

how about fsck_ffs -y / in single user mode?

seems like no clri is needed.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



It fixed the problem :-)

Thank you very much.

/Leslie

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Wojciech Puchar

freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



It fixed the problem :-)


you may risk putting

fsck_y_enable=YES

in your rc.conf




i put background_fsck=NO in /etc/rc.conf too
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Power failure during portsnap fetch update

2012-07-21 Thread Leslie Jensen



2012-07-21 17:33, Wojciech Puchar skrev:

freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



It fixed the problem :-)


you may risk putting

fsck_y_enable=YES

in your rc.conf




i put background_fsck=NO in /etc/rc.conf too
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org



Thank you for the advise. I'll put it in rc.conf

/Leslie
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org