[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: undelete for ext2



on Sun, Aug 05, 2001 at 08:16:08AM -0700, Shriram Shrikumar (prince_shri@yahoo.com) wrote:
> Hi All,
> 
> It was pleasant afternoon when I realised that maybe, today would be
> a good day to move the /var partition just to / so I can use the
> extra space elsewhere and / had a couple of hundred megs not being
> used. I went into singe user mode and then,
> 
> cd /
> mkdir var2
> 
> cd /var
> mv * /var2
> 
> after churning around for a while, it gave up and told me that there
> was no space. I gave up on moving var the var parition and before
> thinking gave
> 
> cd /
> rm var2 -r
> 
> Thus started my adventure into ext2 undeletion software.

<...>

> Any help appreciated.

I was once asked whether or not GNU/Linux had any features to prevent
users from doing bone-headed stupid things.

Yes, I said.

Bitter experience.



You've just learned something.  Your data is, in all likelihood, gone.
You might get parts of it back, but a complete restore is very unlikely,
and will be quite time consuming.

  - Buy yourself a backup system.  I recommend DAT tape, CDR, or
    alternate networked storage.
  - Use it.
  - Take appropriate measures before you do any serious mucking with
    your partitions in the future.

E.g.:  don't 'mv' data, copy it.  This leaves you with two images of the
data, in the event one goes bad.

Your going to single-user mode was the one smart thing you'd done --
this minimizes any changes to data while you're working.  Better yet,
boot a rescue system and mount the partitions you're doing surgery on
someplace outside the normal filesystem heirarchy.

My MO for any filesystem surgery is:

    - Go single-user or boot a rescue system.

    Do *both* the following:

    - Create tape backups of data to be moved.
    - Create filesystem backups (either locally, if space permits, or networked
       to another station).

    This provides redundant backups, and gives me one fast method for
    restoring data (the filesystem backups).

    - VERIFY YOUR BACKUPS.  Missing, incomplete, or inaccurate backups
      won't do much for you.

    - *COPY* data from old to new locations.  Various means work, I
      prefer the older:

          $ tar cvf - <old dir>/* | ( cd <new dir>; tar xvf - )

    - *VERIFY* the move:

          $ diff --recursive --brief <old-dir> <new-dir>

    - Rename the old tree, and move the new tree to its location.
      Change mount points if appropriate.

    - Resume multi-user operation or reboot system.  Sniff around.  If
      there are any problems, you've still got:

      - A tape archive.
      - A disk archive.
      - The old disk tree.

    - After a suitable test period (minutes, hours, days, your option),
      go ahead and recycle your old bytes by nuking the old directory.

Yes, as a general consequence, repartitioning is a somewhat
time-consuming operation.  This is one of the reasons I try to shoot for
a good, long-lived partitioning schema on my boxen. 

For general backup suggestions:

    http://kmself.home.netcom.com/Linux/FAQs/backups.html

Partitioning suggestions:

    http://kmself.home.netcom.com/Linux/FAQs/partition.html

Cheers.

-- 
Karsten M. Self <kmself@ix.netcom.com>            http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?               There is no K5 cabal
  http://gestalt-system.sourceforge.net/                 http://www.kuro5hin.org
   Free Dmitry!! Boycott Adobe!! Repeal the DMCA!!   http://www.freesklyarov.org
Geek for Hire                          http://kmself.home.netcom.com/resume.html

Attachment: pgpjoZnYBAiqQ.pgp
Description: PGP signature


Reply to: