Linux Tar Guru's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PeekHoles
    Registered User
    • Jan 2002
    • 1151

    #1

    Linux Tar Guru's

    I got a question I have two HD's on my server I want to back my sites over to the other HD once a week. Is there away to tar zip the domains and all sub folders and files in the domain where it keeps its chmod and all permissions on all files and subfolders and it's files? If so can someone please show me the command. Say I want to backup my-domain-name.com with all it's permisiions. That way if I was to have a problem I could just untar the good copy and be back in biz.
  • Radik
    Confirmed User
    • Sep 2003
    • 808

    #2
    Take a look at rsync.

    100% Exclusive, Check Us Out!

    Comment

    • PeekHoles
      Registered User
      • Jan 2002
      • 1151

      #3
      Yeah rsync works good. One of my issues is I got alot of data to move between servers, and wondered if there was a way to tar up the domains that where rsync on the old server. Once all the data is moved over to the new server rsync will be setup on the new server like it is on the old.

      Comment

      • vending_machine
        Confirmed User
        • Jun 2002
        • 1070

        #4
        This should do it:

        Code:
        tar zcfp domains.tgz <paths>
        snip from tar manual:

        Code:
             -p
             --preserve-permissions  Extract all protection information.

        Comment

        • PeekHoles
          Registered User
          • Jan 2002
          • 1151

          #5
          Thanks I will give it a shot.

          Comment

          • dgraf
            Confirmed User
            • Jun 2004
            • 133

            #6
            Originally posted by vending_machine
            This should do it:

            Code:
            tar zcfp domains.tgz <paths>
            snip from tar manual:

            Code:
                 -p
                 --preserve-permissions  Extract all protection information.
            Therefore here is no reason to use this directive while making the archive. The parameter has to be used while extracting. Tar backups the permissions by default but if you do unpack (without the p option) the permissions are stripped according to your umask setting.
            Bright Porn | Webmasters | Free Galleries | Sponsors | Traffic Trades | Hardlinks

            Comment

            • PeekHoles
              Registered User
              • Jan 2002
              • 1151

              #7
              Ok so say this is my tar file after it's been tared up.

              domains.tar


              What will be the command line to untar it with the -p option.

              Comment

              • dgraf
                Confirmed User
                • Jun 2004
                • 133

                #8
                If you used the option "z" before (while packing), you have to use it again while unpacking because "z" means -- use gzip compression. In that case you should use extension .tgz resp. .tar.gz not .tar nex time.

                Finally, you can use either

                Code:
                tar xvf domains.tar
                or

                Code:
                tar xzvf domains.tgz
                depending on if you used the "z" while packing.
                Bright Porn | Webmasters | Free Galleries | Sponsors | Traffic Trades | Hardlinks

                Comment

                • princess
                  Confirmed User
                  • Feb 2001
                  • 1939

                  #9
                  all this linux talk is going to excite us all.. ;)
                  *HUGS*!
                  Marsha

                  Comment

                  • dgraf
                    Confirmed User
                    • Jun 2004
                    • 133

                    #10
                    Yeah, but it is still far better to describe parameters represented by alphanumerical characters than places to click on.
                    Last edited by dgraf; 07-12-2004, 12:36 PM.
                    Bright Porn | Webmasters | Free Galleries | Sponsors | Traffic Trades | Hardlinks

                    Comment

                    • Serge Litehead
                      Confirmed User
                      • Dec 2002
                      • 5190

                      #11
                      $ man tar


                      for huge amounts use bzip2, better compression, a bit slower.

                      something like:
                      tar cvyf archive.tar.bz2 domain_dir/

                      to untar it
                      tar xvyf archive.tar.bz2


                      flag v is verbose, you don't need that in script.

                      Comment

                      • PeekHoles
                        Registered User
                        • Jan 2002
                        • 1151

                        #12
                        Originally posted by holograph
                        $ man tar


                        for huge amounts use bzip2, better compression, a bit slower.

                        something like:
                        tar cvyf archive.tar.bz2 domain_dir/

                        to untar it
                        tar xvyf archive.tar.bz2


                        flag v is verbose, you don't need that in script.


                        So If I use this option when I untar the way you show it. Will it keep the same permissions and such when I untar it on the new server. I just hate having to re chmod all the files and such on my scripts Because once I tar the domain I will use wget and want to untar it and have all the same permissions in such already in place. I use the same file structure and such on both servers. So long as the permissions are the same when I untar I should be fine once I update my mysql DB's.

                        Comment

                        • PeekHoles
                          Registered User
                          • Jan 2002
                          • 1151

                          #13
                          Originally posted by vending_machine
                          This should do it:

                          Code:
                          tar zcfp domains.tgz <paths>
                          snip from tar manual:

                          Code:
                               -p
                               --preserve-permissions  Extract all protection information.

                          Yeah the -p was throwing me off thats why I did not know the command to untar and save all the permissions.

                          Comment

                          Working...