[conspire] filesystem recovery

Rick Moen rick at linuxmafia.com
Tue Jun 1 16:21:36 PDT 2004


Quoting bruce coston (jane_ikari at yahoo.com):

> thanks rick, will try 2get my addresses straight again despite = in middle of w98 failure again.
>      How do i make my ext3 3 again not 2? 

Hi, Bruce.  Sorry to have not replied for a few days:  I've been busy
the last five days running an annual science-fiction convention in San
Jose.

The above leaves a little unclear what your situation is:  Either you
are seeking to create filesystems in currently empty hard drive space
(or drive space you intend to make _become_ empty) and wish to know how
to create partitions as type ext3 rather than ext2, _or_ you are asking
how to convert existing ext2 partitions to ext3.  Those are different,
though related, problems.


1.  To create an ext3 partition directly, simply use the appropriate
"mkfs" (make filesystem) utility.  I'll explain.

On many Linux systems, the family of "mkfs" utilities are all named
"mkfs.[foo]", where [foo] is the particular type of formatting you wish
to use.  For example:

  mkfs.ext3  for ext3
  mkfs.ext2  for ext2
  mkfs.minix  for the Minix format
  mkfs.cramfs  for the cramfs format

Sometimes, one or two of those utilities will have names that don't
quite fit the pattern, e.g., "mkreiserfs" for the Reiser filesystem.

Some other Linux systems will use slightly different names for the ext2
and ext3 utilities, such as "mke2fs" and "mke3fs" (respectively).  Or
both sets of names are sometimes present.

Bottom line:  Because the names are various but all start with the
letters "mk", you should make life simple by (while logged in as the
root user) typing "mk" and hitting the tab key, to see all the
candidates.

Additional observation:  Usually, mkfs.ext3, mkfs.ext2, mke3fs, and
mke2fs (however many of them you have) are in fact all the same utility
under different names:  Some of them are just front-end wrapper scripts
for the underlying ext2/ext3-creation code.  Thus, the ext3 variants are
just the ext2 utility, run with an extra command-line parameter of "-J",
meaning "please create a journal".

In case it wasn't obvious, ext3 is just the plain old ext2 filesystem,
with an added journal-file feature.

When (by whatever means) one creates a journal on an ext2 filesystem, it
is created in the filesystem's root directory as filename ".journal".
Most ways of creating the journal cause the file's existence to be
hidden at mount time -- a good thing.  But don't fret if you end up with
a visible .journal file.  There's nothing wrong with that.  It's just a
tiny bit untidy to see something that's more properly hidden from view
as part of the plumbing.


2.  To add a journal to an existing ext2 filesystem (and thereby convert
it into ext3):  

First, unmount the filesystem.  That, in turn, you can really do (in
most cases) only if you aren't booted from that disk, so this task is
best done by booting a Linux maintenance CDR or floppy.

Then, run "tune2fs -J /dev/hda" (or whatever's appropriate in place of
hda).  The "-J", again, means "please create a journal".

Last, you would want to edit /etc/fstab (the "filesystem table" file) to
ensure that the filesystem gets mounted as type ext3 rather than ext2.
(Any ext3 filesystem _can_ be mounted as type ext2, but then you're
deliberately ignoring the journal file, in which case why bother to have
one?)


In the case of my own server, I didn't bother to read any documentation
before converting it from ext2 to ext3, so I ended up having a visible
".journal" file in each filesystem's top directory.  For example:

:r! ls -al /

total 16509
drwxr-xr-x   18 root     root         4096 2004-03-14 11:43 .
drwxr-xr-x   18 root     root         4096 2004-03-14 11:43 ..
drwxr-xr-x    2 root     root         4096 2004-03-14 11:52 bin
drwxr-xr-x    3 root     root         1024 2004-03-14 23:09 boot
drwxr-xr-x    6 root     root        20480 2004-03-28 06:47 dev
drwxr-xr-x   97 root     root         8192 2004-05-20 15:38 etc
drwxr-sr-x   13 root     staff        4096 2004-03-24 02:06 home
drwxr-xr-x    2 root     root         4096 2001-04-14 17:45 initrd
-rw-------    1 root     root     16777216 2002-12-16 12:38 .journal
drwxr-xr-x    7 root     root         8192 2004-03-14 11:49 lib
drwxr-xr-x    2 root     root        16384 2001-05-30 04:57 lost+found
drwxr-xr-x    6 root     root         4096 2001-05-30 11:17 mnt
lrwxrwxrwx    1 root     root           14 2003-11-11 21:38 opt -> /usr/local/opt
dr-xr-xr-x  112 root     root            0 2004-01-10 11:47 proc
drwxr-xr-x   11 root     root         4096 2004-06-01 06:34 root
drwxr-xr-x    2 root     root         4096 2004-03-14 11:52 sbin
drwxr-xr-x    2 root     root         4096 2004-01-20 09:28 sys
drwxrwxrwt    5 root     root         8192 2004-06-01 16:02 tmp
drwxr-xr-x   13 root     root         4096 2003-10-12 16:38 usr
drwxr-xr-x   16 root     root         4096 2003-10-21 01:39 var


That was kind of dumb of me (albeit harmless).  I can and should correct
the error, but I've never had a good occasion to take my system down in
order to fix it.

> got both printers working a role ea. fine on lpt1:, something0, and
> usb. sound etc. next.

Good going!

-- 
Cheers,                   The cynics among us might say:   "We laugh, 
Rick Moen                 monkeyboys -- Linux IS the mainstream UNIX now!
rick at linuxmafia.com       MuaHaHaHa!" but that would be rude. -- Jim Dennis




More information about the conspire mailing list