|
Home > Archive > Linux Debian support > August 2005 > Restoring a destroyed /var partition
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Restoring a destroyed /var partition
|
|
| Madhusudan Singh 2005-08-22, 5:52 pm |
| Hi
I needed to reformat my /var partition from reiserfs to ext3 on a working
Debian system. So, I copied the contents of /var over to another
partition /backup. Went down to run level 1 (telinit 1). Unmounted /var.
Reformatted it (mkfs -t ext3 /dev/sda8) and then made a blunder :
mv /backup/* /var
Now /var was not mounted then. So, I guess the above just created a
directory named var under /, and then I rebooted. You can imagine what
happened next - /var ended up being empty. The boot would now hang at
syslogd. I then logged in the single user mode. Created /var/run
and /var/log and then an empty file /var/run/utmp.
However, the machine is now practically useless - no network connection,
many programs crash complaining of missing shared libraries, etc. How do I
get out of this mess short of reinstalling Debian ?
Thanks.
| |
| Floyd L. Davidson 2005-08-22, 5:52 pm |
| Madhusudan Singh <spammers-go-here@spam.invalid> wrote:
>Hi
>
>I needed to reformat my /var partition from reiserfs to ext3 on a working
>Debian system. So, I copied the contents of /var over to another
>partition /backup. Went down to run level 1 (telinit 1). Unmounted /var.
>Reformatted it (mkfs -t ext3 /dev/sda8) and then made a blunder :
>
>mv /backup/* /var
>
>Now /var was not mounted then. So, I guess the above just created a
>directory named var under /, and then I rebooted. You can imagine what
>happened next - /var ended up being empty. The boot would now hang at
>syslogd. I then logged in the single user mode. Created /var/run
>and /var/log and then an empty file /var/run/utmp.
>
>However, the machine is now practically useless - no network connection,
>many programs crash complaining of missing shared libraries, etc. How do I
>get out of this mess short of reinstalling Debian ?
All you need to do is go back and *finish* what you started! Go
to runlevel 1 again, umount /var, and "mv /var/* /backup" and
you will be right where you left off.
First mount your new partition on /var, then *copy* your files
back to it,
mount -t ext3 /dev/sda8 /var
cp -a /backup/* /var
Now you can go back to multi-user mode and all should be fine.
If it is, you can delete all of the files in /backup.
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
| |
| Madhusudan Singh 2005-08-22, 5:52 pm |
| Floyd L. Davidson wrote:
> Madhusudan Singh <spammers-go-here@spam.invalid> wrote:
>
> All you need to do is go back and *finish* what you started! Go
> to runlevel 1 again, umount /var, and "mv /var/* /backup" and
> you will be right where you left off.
>
> First mount your new partition on /var, then *copy* your files
> back to it,
>
> mount -t ext3 /dev/sda8 /var
> cp -a /backup/* /var
That will not work. I used the mv command. Which means that /backup is now
empty.
| |
| Madhusudan Singh 2005-08-22, 5:52 pm |
| Floyd L. Davidson wrote:
> Madhusudan Singh <spammers-go-here@spam.invalid> wrote:
>
> All you need to do is go back and *finish* what you started! Go
> to runlevel 1 again, umount /var, and "mv /var/* /backup" and
> you will be right where you left off.
But wasn't /var (directory under /) overwritten the moment I booted
with /var partition ? There cannot be two var's under / (one a directory)
and the other a partition /var.
| |
| Lenard 2005-08-22, 5:52 pm |
| Madhusudan Singh wrote:
>
> But wasn't /var (directory under /) overwritten the moment I booted
> with /var partition ? There cannot be two var's under / (one a
> directory) and the other a partition /var.
The var directory in the root partition was hidden (not overwritten)
when you mounted the var partition. Once you unmount the var partition
the var directory should reappear.
--
Contained within the Microsoft EULA;
This Limited Warranty is void if failure of the Product has resulted
from accident, abuse, misapplication, abnormal use or a virus.
| |
| Madhusudan Singh 2005-08-22, 5:52 pm |
| Lenard wrote:
> Madhusudan Singh wrote:
>
>
> The var directory in the root partition was hidden (not overwritten)
> when you mounted the var partition. Once you unmount the var partition
> the var directory should reappear.
>
>
Indeed, it was. I was not aware of this type of behavior. Thanks to all that
helped. Back in business now.
| |
| Floyd L. Davidson 2005-08-22, 5:52 pm |
| Madhusudan Singh <spammers-go-here@spam.invalid> wrote:
>Floyd L. Davidson wrote:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[vbcol=seagreen]
>
>That will not work. I used the mv command. Which means that /backup is now
>empty.
Not true.
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
|
|
|
|
|