• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

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)?

0
CME-IT
Asked:
CME-IT
  • 3
  • 3
1 Solution
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now