old-www/HOWTO/Flash-Memory-HOWTO/maintain.html

332 lines
6.1 KiB
HTML

<HTML
><HEAD
><TITLE
> Maintenance</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="USB Flash Memory HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE=" Making the memory stick accessible to users"
HREF="users.html"><LINK
REL="NEXT"
TITLE=" The Linux-2.6 kernel"
HREF="linux-2.6.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>USB Flash Memory HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="users.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="linux-2.6.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="maintain"
></A
>11. Maintenance</H1
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="fs-inspect"
></A
>11.1. Filesystem inspection</H2
><P
>&#13; It is a virtuous habit to inspect your ext2 filesystem on the
flash memory regularly. To do this, the tool
<SPAN
CLASS="application"
>dumpe2fs</SPAN
> may be used in the following way:
<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>dumpe2fs</B
> -h /dev/sda1</B
></TT
> (you must be root and
the device should not be mounted). The result should be similar to
the following:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; Filesystem volume name: &#60;none&#62;
Last mounted on: &#60;not available&#62;
Filesystem UUID: c42a6963-5e6a-4cd2-b7d7-c8f09dca6c52
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: dir_index filetype sparse_super
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 32000
Block count: 127856
Reserved block count: 6392
Free blocks: 116456
Free inodes: 31922
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 2000
Inode blocks per group: 250
Filesystem created: Sat Sep 20 12:43:00 2003
Last mount time: Tue Oct 28 14:13:03 2003
Last write time: Tue Oct 28 14:28:27 2003
Mount count: 13
Maximum mount count: 35
Last checked: Sat Oct 18 11:28:26 2003
Check interval: 15552000 (6 months)
Next check after: Thu Apr 15 11:28:26 2004
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Default directory hash: tea
Directory Hash Seed: 118bee0a-efa5-4771-967e-41a0badd0355
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; A few important aspects need to be pointed out.
</P
><P
></P
><UL
><LI
><P
>&#13; When the ext2 filesystem is created, it is by default
given maximal usage before it has to be checked. These can
be seen <EM
> Maximum mount count </EM
> (35) and
<EM
> Check interval</EM
> (expiry date).
</P
></LI
><LI
><P
>&#13; The usage so far: <EM
> Mount count</EM
> and
<EM
> Last checked</EM
> .
</P
></LI
><LI
><P
>&#13; The existence of corrupted files (bad blocks):
<EM
> Filesystem state</EM
> .
</P
></LI
></UL
><P
>&#13; You might get warnings about these things when you mount the
device or when you try the read files from the device.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="and-then"
></A
>11.2. And then?</H2
><P
>&#13; When the usage allocation has been spent, or there is evidence of
file corruption, the thing to do is to run <TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>fsck.ext2</B
> /dev/sda1</B
></TT
> with the device unmounted. After that, usage
parameters will be freshly allocated and bad blocks will be gone.
</P
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>
When dealing with the vfat system, the <SPAN
CLASS="application"
>&#13; dump</SPAN
> does not seem to exist. The command
<TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>dumpe2fs</B
> -f /dev/sda1</B
></TT
> for filesystems
other than ext2 does not work for vfat. The tool <SPAN
CLASS="application"
>&#13; dosfsck</SPAN
> exists (it is still Alpha), and may be
risky to use on a device you have not formatted yourself.
</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="users.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="linux-2.6.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Making the memory stick accessible to users</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The Linux-2.6 kernel</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>