Results 1 to 15 of 15
  1. #1
    Registered
    Join Date
    Jul 2006
    Posts
    24

    tarball to be created in another directory

    I want to zip my /home directory, but have the tarball file created outside of /home to avoid a "double compression" problem.

    I have tried several variations of tar with various switches and destinations, but nothing wants to work. Have read the tar man pages and they are way too technical for me, and google is not being helpful.

    Could I trouble someone to please give me the line of code to collect everything in my current /home and zip it into one tarball,

    and have the tarball show up in /opt (where there is space for it (or if /opt is not a good place to put it, your suggestion)?

    Any explanation of what any recommended switches accomplish in simple English will be greatly appreciated.

    I think the basic tarball creation should be the following, which please confirm, but how to get the tarball created in /opt directory?

    tar -czvf currenthome.tar.gz /home

    Many thanks

  2. #2
    Inactive Pokémon Moderator JigPu's Avatar
    Join Date
    Jun 2001
    Location
    Vancouver, WA
    Posts
    6,576
    You should be able to either explicitly state that /opt is the output directory:
    Code:
    tar -czvf /opt/currenthome.tar.gz /home
    or to change to /opt before running the command:
    Code:
    cd /opt
    tar -czvf currenthome.tar.gz /home
    If these don't work, what errors do you get?

    JigPu
    .... ASRock Z68 Extreme3 Gen3
    .... Intel Core i5 2500 ........................ 4 thread ...... 3300 MHz ......... -0.125 V
    2x ASUS GTX 560 Ti ............................... 1 GiB ....... 830 MHz ...... 2004 MHz
    .... G.SKILL Sniper Low Voltage ............. 8 GiB ..... 1600 MHz ............ 1.25 V
    .... OCZ Vertex 3 ................................. 120 GB ............. nilfs2 ..... Arch Linux
    .... Kingwin LZP-550 .............................. 550 W ........ 94% Eff. ....... 80+ Plat
    .... Nocuta NH-D14 ................................ 20 dB ..... 0.35 C°/W ................ 7 V


    "In order to combat power supply concerns, Nvidia has declared that G80 will be the first graphics card in the world to run entirely off of the souls of dead babies. This will make running the G80 much cheaper for the average end user."
    "GeForce 8 Series." Wikipedia, The Free Encyclopedia. 7 Aug 2006, 20:59 UTC. Wikimedia Foundation, Inc. 8 Aug 2006.

  3. #3
    Registered
    Join Date
    Jul 2006
    Posts
    24
    JigPu, The first option seems to be working like a charm. Lines of text are flying by on the screen.

    Many thanks for the quick reply.

  4. #4
    Overclockix Snake Charming Senior
    Alt OS Content Editor
    Stratus_ss's Avatar
    Join Date
    Jan 2006
    Location
    Ontario Canada
    Posts
    3,868
    Helpful hint:
    If you want to extract to another you would do the following

    Code:
    tar xvzf sometarfile.tar.gz -C /<new destination>
    I use this a lot
    HEAT
    Those wishing to contribute to the AltOS section front page please PM me.

    Leviathan41: "Playing with a controller because the mouse and keyboard is too easy is like racing with a bicycle because a car is too fast."

    Chris Fisher "Windows is like Administration with training wheels"

  5. #5
    Registered
    Join Date
    Jul 2006
    Posts
    24
    The guidance did indeed work, but this is becoming more complicated.

    I thought that I had deleted the old home.tar.gz from the /home directory, but had not. So the new tar file of /home contained the previous tar file. (The new tar file is 32GB!)

    So I deleted the new tar file from /opt, then deleted the old home.tar.gz from /home. Then emptied the trash.

    Then logged out and at the intitial login screen, pressed Alt-Ctrl-F1 to bring up a command line terminal. But Alt-Ctrl-F1 now doesn't work.

    I rebooted a couple of times, then powered off, but Alt-Ctrl-F1 still doesn't work. So I then logged in, brought up a console and tried to create the tar from the console, but it failed. Arrrrrgh!

    So now I need to get Alt-Ctrl-F1 working again at the Login screen. Any ideas?

    EDIT: Found it! Ctrl key on keyboard failed! What are the chances of that? Thanks.
    Last edited by Odyssey1942; 03-06-12 at 08:11 AM. Reason: as stated

  6. #6
    Registered
    Join Date
    Jul 2006
    Posts
    24
    Much more complicated. Still bashing away and seem to be no closer to success. In fact I am in a terrible muddle. Here is a summary of the history:

    in old computer I ran:
    Code:
    tar -czvf /opt/username120307.tar.gz /username
    (put into opt to keep from creating the tarball within the directory being zipped),

    then from within /opt
    Code:
    scp username120307.tar.gz /home@192.168.0.104
    which failed with error message: "permission denied, please try again" (i.e., would not accept my password [which I know is correct and retried several times]), then
    Code:
    scp username120307.tar.gz /username@192.168.0.104
    which worked (so for some reason, /home and /username on the new computer seem to need different passwords?)

    Then in /home at the new computer, I renamed /username /username2, moved username120307.tar.gz into /home and unpacked it.

    Now when I boot up new computer, I put in my password at login as normal, but then get the following three error messages on a blank desktop (color only, no icons)

    1)Could not update ICEauthority file /home/username/ICEauthority
    2)There is a problem with the configuration server. (/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256)
    3)Nautilus could not create the following required folders: /home/username/Desktop, /home.username.nautilus (Before running Nautilus, please create these folders, or set permissions such that Nautilus can create them.)

    So can anyone see anything in the above that caused this whole process to go pear shaped?

    Secondly, why do /home and /username on the new computer seem to need different passwords in order to scp the files over?

    I am very much a noob at the command line, so more information rather than less will be so appreciated (I hope to learn something from all this) Thanks.
    Last edited by Odyssey1942; 03-07-12 at 11:05 PM.

  7. #7
    Member dropadrop's Avatar
    Join Date
    Mar 2001
    Location
    Finland
    Posts
    2,718
    If you run:

    Code:
    scp whatever.tar.gz user@192.168.0.1
    You will actually be copying it to a local file on the same computer called user@192.168.0.1

    Your whole syntax seems to be wrong...

    Correct syntax is:

    Code:
    scp filename user@host:path_on_the_host
    Optional parameters are user (if you have the same username on the other end) and path (without it the file will go in your own home directory on the other host). If you don't include the user parameter then you don't include the @ charecter, but if you don't include the path you still have to add : after the hostname / ip or it will copy it to a local file.

    So looking at the two scp commands you put they should have probably been:

    Code:
    scp username120307.tar.gz 192.168.0.104:/home
    Which would try to copy the file under /home on the remote computer (which would probably fail as writing under /home would require root permissions)

    and

    Code:
    scp username120307.tar.gz username@192.168.0.104:
    which would copy the file under /home/username on the remote host (assuming home directories are there on the server).

    You should only have one password for a username on the computer, but my guess is that either while making the scp to the local computer (which I recollect does not prompt for a password) or defining the path in place of the username you where getting password problems, for example if you did this:

    Code:
    scp username120307.tar.gz /home@192.168.0.104:
    It would try to log into the remote computer as user "/home" meaning the password would fail.

    edit:

    For completeness here is something I wrote up as a reminder when I was doing something similar a few years ago, only the local machine did not have enough space to store the created tar file. I just piped creation of the tar file over SSH to the remote host:

    Code:
    tar czvf - folder/ | ssh foo@bar "cat > /tmp/foo.tar.gz"
    Last edited by dropadrop; 03-08-12 at 04:23 AM.

  8. #8
    Registered
    Join Date
    Jul 2006
    Posts
    24
    dropadrop,

    Thanks for yours which I am studying and have a couple of questions.

    In your first example, the result of my doing that was to transfer (copy?) the tarball into the existing user on NEW computer (user in both computers is robert)

    The actual code I first tried to use was;
    Code:
    scp robert120307.tar.gz /home@192.168.0.104
    and when I did, it asked for a password. I gave my normal password, but was denied access. BTW, I tried it several times, checked the caps key, etc, so I am sure it was my normal password for robert on the NEW computer

    So then I tried
    Code:
    scp robert120307.tar.gz /robert@192.168.0.104
    . Password again requested, but this time accepted, and the file robert120307.tar.gz turned up in /home/robert on NEW.

    I then renamed robert as robertorig, moved the tarball into /home, and extracted it. It created a user (/home/robert) just as I expected.

    So I rebooted, logged in, but was presented with the three error messages above. I closed each and was then left looking at an Ubuntu orange/brown background colour.

    Should I have omitted the renaming step and just unpacked it in /home/robert?

    I have other questions about yours, but thought it might be easier to go one step at a time. I look forward to your further advice. Thanks.

  9. #9
    Overclockix Snake Charming Senior
    Alt OS Content Editor
    Stratus_ss's Avatar
    Join Date
    Jan 2006
    Location
    Ontario Canada
    Posts
    3,868
    Quote Originally Posted by Odyssey1942 View Post
    dropadrop,

    The actual code I first tried to use was;
    Code:
    scp robert120307.tar.gz /home@192.168.0.104
    and when I did, it asked for a password. I gave my normal password, but was denied access. BTW, I tried it several times, checked the caps key, etc, so I am sure it was my normal password for robert on the NEW computer

    So I rebooted, logged in, but was presented with the three error messages above. I closed each and was then left looking at an Ubuntu orange/brown background colour.
    I think you misunderstand let me give you an exact example
    Assume I have some tar in opt, and my destination is a remote computer
    Code:
    scp /opt/stratus_home.tar.gz stratus@stratus-desktop:/opt
    This will put stuff from my current opt onto my desktop in the /opt/. This assumes that the user "stratus" has write permissions to the /opt directory on stratus-desktop

    Also, just extracting the home directory does not create a user, it simply creates a folder. It is always good practice to make sure the user ID's match the new system (for example if on startus-laptop my home was owned by stratus with an ID of 500, but on my desktop user "stratus" had an ID of 501, user stratus on the desktop would not be allowed to use the /home/stratus folder I just extracted

    To make sure you have the proper permissions you should do the following

    Code:
    sudo chown -R stratus:stratus /home/stratus
    This will reset the user ID's in the folder specified (and all sub folders)

    additionally you did not post (or I may have missed it) what three errors you encountered
    HEAT
    Those wishing to contribute to the AltOS section front page please PM me.

    Leviathan41: "Playing with a controller because the mouse and keyboard is too easy is like racing with a bicycle because a car is too fast."

    Chris Fisher "Windows is like Administration with training wheels"

  10. #10
    Registered
    Join Date
    Jul 2006
    Posts
    24
    OK, I think I have it now and the proposed solution worked. Thank you for your patience in this.

    BTW, the earlier posting contained this:

    Now when I boot up new computer, I put in my password at login as normal, but then get the following three error messages on a blank desktop (color only, no icons)

    1)Could not update ICEauthority file /home/username/ICEauthority
    2)There is a problem with the configuration server. (/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256)
    3)Nautilus could not create the following required folders: /home/username/Desktop, /home.username.nautilus (Before running Nautilus, please create these folders, or set permissions such that Nautilus can create them.)

  11. #11
    Overclockix Snake Charming Senior
    Alt OS Content Editor
    Stratus_ss's Avatar
    Join Date
    Jan 2006
    Location
    Ontario Canada
    Posts
    3,868
    Hey mate,

    for those who come after you, would you mind specifying which solution(s) worked for you since there were several in this thread

    cheers
    Last edited by Stratus_ss; 03-10-12 at 07:09 AM.
    HEAT
    Those wishing to contribute to the AltOS section front page please PM me.

    Leviathan41: "Playing with a controller because the mouse and keyboard is too easy is like racing with a bicycle because a car is too fast."

    Chris Fisher "Windows is like Administration with training wheels"

  12. #12
    Registered
    Join Date
    Jul 2006
    Posts
    24
    Yes, sorry about that. I was indeed all over the map. It was Stratus' suggestion of
    Code:
    sudo chown -R stratus:stratus /home/stratus
    which in my case was:

    Code:
    sudo chown -R robert:robert /home/robert
    In spite of appearances, this has been a huge learning curve for me. Thanks to all who helped me through to a solution.

  13. #13
    Member dropadrop's Avatar
    Join Date
    Mar 2001
    Location
    Finland
    Posts
    2,718
    Great to hear you got it to work!

  14. #14
    Overclockix Snake Charming Senior
    Alt OS Content Editor
    Stratus_ss's Avatar
    Join Date
    Jan 2006
    Location
    Ontario Canada
    Posts
    3,868
    Hopefully the part about UIDs was clear. That is a fundamental part of working with linux

  15. #15
    Member
    Join Date
    Oct 2011
    Location
    Orange County, CA
    Posts
    132
    In complicated cases you can always decouple tar generation and compression or decompression/extraction, for example if you want to use a different compression program, compression options etc:
    tar cvf - something | gzip -c9 >destfile.tar.gz
    ( cd somewhere; tar cvf - something ) | ( cd somewhere_else; pbzip2 -c9 >destfile.tar.bz2)
    Yeah that last one could be done with tar cCvf I know. Just wanted to demonstrate how to use a subshell with multiple commands there.
    Similar for decompression:
    pbzip2 -dc <tarfile.tar.bz2 | ( cd somewhere; tar xvf - )
    I have had cases where double buffering improved performance:
    dd if=tarfile.tar.bz2 bs=64M | dd bs=64M | pbzip2 -dc | tar xvf -
    etc...
    Mobo: Asus Crosshair V Formula
    CPU: FX-8150 4.6GHz @1.4125V
    HSF: Noctua NH-D14+Delta PFC1212DE-PWM
    RAM: 4x Kingston KVR1333D3E9S/4GEC 1866@1.45V
    GPU: ECS Nvidia GT430
    PSU: Seasonic X750 Gold
    HDD: 4x Seagate Barracuda XT ST33000651AS RAID10
    SSD: Corsair Force GT 120GB
    OS: Debian wheezy/XFCE4
    Case: Fractal Design Define XL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •