What is the best way to tar a directory and to maintain ownership?

I need to transfer email accounts from an existing linux mail server to a new Centos (Redhat - Enterprise) email server.  The original server is using sendmail and the new server has postfix.  Both have the same file structure. /var/spool/mail

What is the exact command to tar all the mail accounts and to then untar them on the new server?

I have created user accounts for all the users.

There are currently mailing lists on the original server (sendmail).  Is there an easy way to copy the mailing list to the new server (postfix)?

CME-ITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CME-ITAuthor Commented:
I need to clearify something in my post.  When I said mailing list, I am not talking about anything like majordomo, etc. Instead it is more like a group.  One list/group is called everyone and if an email is addressed to everyone, everyone in the company gets a copy of it.

Thank-you in advance.
0
ahoffmannCommented:
> tar mail folders
tar cf folders.tar /var/spool/mail

> Is there an easy way to copy the mailing list to the new server
I guess they are configured in /etc/aliases, the same file can be used with postfix too.
0
CME-ITAuthor Commented:
I could not find the /etc/aliases

I know this is a "newbie" question, but I want to make sure I understand everything correctly.

with the command:
tar cf folders.tar /var/spool/mail

I will be creating a tar file called folders.tar in the current directory (whatever it is).  Am I correct?

After copying the tar file to the new server, I would enter the following command from the directory where the folders.tar file is located:

tar xf folders.tar /var/spool/mail

This would untar the file and overwrite what is currently in the /var/spool/mail folder.  Am I understanding this correctly?

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ahoffmannCommented:
> I could not find the /etc/aliases
hmm, could be /etc/mail/aliases, if all fails try:
  find / -type f -name aliases

> Am I correct?
yes


> I would enter the following command ..
no
cd / && tar xf folders.tar
( you should be root to do that)
Keep in mind that you need to have the user group id in /etc/{group,passwd} otherwise you get permission problems

> This would untar the file and overwrite what is currently in the /var/spool/mail folder
yes
0
CME-ITAuthor Commented:
I did find the /etc/mail/aliases Thank-you

>cd / && tar xf folders.tar

What are the && for?  Does that mean the directory were the folders.tar files are located?

So long as I am in the directory that the folders.tar file is in, when the file is untarred, it will put all files in the same directory as when they were created.  Correct?
0
ahoffmannCommented:
> What are the && for?  Does that mean the directory were the folders.tar files are located?
oops, was too lazy again.
The tar file needs to be in / for this command, or you need to use a full path for folfers.tar
the && is a logical and in the CLI which executes the tar command if the preceeding command (cd here) succeds
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.