PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : how to copy /var/spool/mail



Rebell
23.07.02, 09:04
When I try to copy /var/spool/mail with or without Flag -a I get an NULL-File which named "mail".

Who know how to copy or to archive this full order succesfully?

muchmarc
23.07.02, 09:44
Well, I don't know what you really want, but I guess
you want to backup all files in /var/spool/mail

$cp /var/spool/mail/* destination-directory

be sure that you are root, otherwise you
can get some troubles with your permissions...


kindly regards
muchmarc

Harry
23.07.02, 09:51
Hello,

if you just want to preserve the file-attributes then the command
cp -a /var/spool/mail <dest-directory>
should do the job as root.

Anyways you may want to use alternatively rsync. That would be the command
rsync -av /var/spool/mail <dest-directory>with the same result (resp. as root).

Harry

Rebell
23.07.02, 10:21
Sorry... the cp command doesnt work. When I copy all the files to the destination directory, the target will be corrupted... it has 0 kBytes in there. When I try to tar this directory, the missbuilding will be the same.

I already tried to stop following services:
sendmail (stopped)
cronjob (stopped)
apache (stopped)

I also tried rsync, but this command was not found on my standard-debian system...

btw: I'm always root when I want to do systemworx - really ;-)

Rebell
23.07.02, 10:38
Ok, I show you my result. It will be created a symbolic link, but why?



baby:~/var/spool# cp -r -p --parents -d /var/spool/mail /root
baby:~/var/spool# ls -la
total 8
drwxr-xr-x 2 root mail 4096 Jul 23 09:47 .
drwxr-xr-x 3 root root 4096 Jan 10 2002 ..
lrwxrwxrwx 1 root mail 7 Jul 23 09:47 mail -> ../mail
baby:~/var/spool#

Harry
23.07.02, 10:39
Hello,


Original geschrieben von Rebell
When I copy all the files to the destination directory, the target will be corrupted... it has 0 kBytes in there. When I try to tar this directory, the missbuilding will be the same.

sounds like your filesystem is corrputed.
Did you already try a filesystem-check?

Harry

Rebell
23.07.02, 10:48
Nein, daran liegts 100%tig nicht. Ich hab noch ein bisschen rumprobiert:

cp -p -s -r -d --parents /var/spool/mail /root

ist die Lösung. Jetzt muss ich nur noch das ganze Ding mit tar packen... und dann hab ich erreicht was ich wollte, denn einfach so tar funktioniert auch nicht ... wer weiß...

trotzdem danke

muchmarc
23.07.02, 10:51
@Rebell
erst englisch, jetzt deutsch
wann sächsisch?
*g*

mfg
muchmarc

Rebell
23.07.02, 11:00
nee eyh isch globs ni.
Jezd konndsch das Forzaischnis zwor gobiern, abor des tar backen fungschdionierd immor no ni...

ihr muessd euch forsdelln, dass isch das var/spool/mail jezd im root-Stammforzaischnis hab. Abor en
tar cv -f mails.tar var/ fungschdionierd immor no ni...

isch hab echt keene ahnung...

ps: das soll nicht heißen das thema sei mir nicht wichtig, es drückt nur meine Charakterperson aus

muchmarc
23.07.02, 11:10
nu guuge moa:

dein tar-befeeel sieht ja gomisch aus.
*huchisdasanstrengend*

Dein tar-Befehl will doch das ganze /var -Verzeichnis
kompremieren, oder?

mfg
muchmarc

P.S.
wenn das nicht geht, über ein Skript gehen.
Erst in ein tempVerzeichnis kopieren und
dann jedes file packen...

Rebell
23.07.02, 11:14
Na ich hab das schonmal gemacht, nämlich mit /home
da geht es ohne Probleme von der Hand... zeigt sogar jede Datei und Verrzeichnis an welches archiviert wird.. nur eben bei diesem Verzeichnis net...

(du bist Sachse?)

Rebell
23.07.02, 11:38
Ok, I was teached by an colleague. The right command must be:

tar cvpsf ~/mail.tar /var/spool/mail/*


enjoy *g*

Harry
23.07.02, 11:39
Hallo,

Dein Verzeichnis /var/spool/mail ist ganz offensichtlich ein SymLink auf /var/mail.

Wenn Du also bisher /var/spool/mail kopiert hast, dann hat das 100%ig funktioniert; nur hattest Du dann den SymLink im Zielverzeichnis.

Was hältst Du davon, wenn Du stattdessen einfach /var/mail kopierst?

Harry

btw: Ja - warum zuerst englisch?