The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

question about the 'tar' command

Discussion in 'General Discussion' started by c9net, Jun 7, 2004.

  1. c9net

    c9net Member

    Joined:
    Dec 23, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I need to move 7.6gb of data on my /home partition to another server. I think the way to do this is to 'tar' up the files into one big file. My only partition with enough space to hold 7.6gb of data happens to be the /home one.

    I was thinking I could type:

    cd /home
    tar -cvf backup.tar *

    but then I thought it might backup the backup.tar over and over and fill the partition up (117gb).

    anyone know the correct way to do this, or am I worrying too much?


    thanks!:D


    tom
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    A few issues here:

    1. It won't backup itself, tar has a little brains ;)

    2. You're unlikely to be able to create a tar file > 2GB, it's a limitation of the file system

    3. To overcome 2. you could use the -z option to zip the files as you tar them, thus compressing them:

    cd /home
    tar -cxvf backup.tar.gz *
     
  3. c9net

    c9net Member

    Joined:
    Dec 23, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    hey thanks!:)

    I created a 2.5gb tar earlier of the /var/lib/mysql (with mysql stopped), and it appeared to work ok, it's running ext3 as the file system, I don't know if this is important or not:confused:

    I'll give it a go and see if anything breaks;)


    thanks!

    tom
     
  4. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    cd /home
    tar -cxvf backup.tar.gz *


    I do believe that is a typo - you cannot [c]ompress & e[x]pand at the same time. ;)

    cd /home
    tar -zcf home_backup.tar.gz ./*

    Is what I would use. :)
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Might have been, might have been ;)
    Actually, I'd have used:
    tar -czf home_backup.tar.gz ./* :p
     
Loading...

Share This Page