Notices

Overclockers Forums > Software > Alternative Operating Systems
Alternative Operating Systems Linux, Mac, Unix Operating Systems and Applications
Forum Jump

tarball to be created in another directory

Post Reply New Thread Subscribe Search this Thread
 
 
Thread Tools
Old 03-05-12, 07:53 PM Thread Starter   #1
Odyssey1942
Registered



Join Date: Jul 2006

 
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
Odyssey1942 is offline   QUOTE Thanks
Old 03-05-12, 09:21 PM   #2
JigPu
Inactive Pokémon Moderator

 
JigPu's Avatar 

Join Date: Jun 2001
Location: Vancouver, WA

10 Year Badge
 
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.
JigPu is offline   QUOTE Thanks
Old 03-05-12, 09:38 PM Thread Starter   #3
Odyssey1942
Registered



Join Date: Jul 2006

 
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.
Odyssey1942 is offline   QUOTE Thanks
Old 03-06-12, 05:35 AM   #4
Stratus_ss
Overclockix Snake Charming Senior
Alt OS Content Editor

 
Stratus_ss's Avatar 

Join Date: Jan 2006
Location: Ontario Canada

 
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"
Stratus_ss is offline Author Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 03-06-12, 07:58 AM Thread Starter   #5
Odyssey1942
Registered



Join Date: Jul 2006

 
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
Odyssey1942 is offline   QUOTE Thanks
Old 03-07-12, 04:20 PM Thread Starter   #6
Odyssey1942
Registered



Join Date: Jul 2006

 
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.
Odyssey1942 is offline   QUOTE Thanks
Old 03-08-12, 03:51 AM   #7
dropadrop
Member

 
dropadrop's Avatar 

Join Date: Mar 2001
Location: Finland

10 Year Badge
 
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.
dropadrop is offline   QUOTE Thanks
Old 03-08-12, 08:04 PM Thread Starter   #8
Odyssey1942
Registered



Join Date: Jul 2006

 
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.
Odyssey1942 is offline   QUOTE Thanks
Old 03-08-12, 08:30 PM   #9
Stratus_ss
Overclockix Snake Charming Senior
Alt OS Content Editor

 
Stratus_ss's Avatar 

Join Date: Jan 2006
Location: Ontario Canada

 
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"
Stratus_ss is offline Author Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 03-08-12, 09:48 PM Thread Starter   #10
Odyssey1942
Registered



Join Date: Jul 2006

 
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:

Quote:
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.)
Odyssey1942 is offline   QUOTE Thanks
Old 03-09-12, 07:15 AM   #11
Stratus_ss
Overclockix Snake Charming Senior
Alt OS Content Editor

 
Stratus_ss's Avatar 

Join Date: Jan 2006
Location: Ontario Canada

 
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

__________________
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"

Last edited by Stratus_ss; 03-10-12 at 07:09 AM.
Stratus_ss is offline Author Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 03-09-12, 11:57 AM Thread Starter   #12
Odyssey1942
Registered



Join Date: Jul 2006

 
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.
Odyssey1942 is offline   QUOTE Thanks
Old 03-12-12, 05:10 AM   #13
dropadrop
Member

 
dropadrop's Avatar 

Join Date: Mar 2001
Location: Finland

10 Year Badge
 
Great to hear you got it to work!
dropadrop is offline   QUOTE Thanks
Old 03-12-12, 11:44 AM   #14
Stratus_ss
Overclockix Snake Charming Senior
Alt OS Content Editor

 
Stratus_ss's Avatar 

Join Date: Jan 2006
Location: Ontario Canada

 
Hopefully the part about UIDs was clear. That is a fundamental part of working with linux
Stratus_ss is offline Author Profile Folding Profile Heatware Profile   QUOTE Thanks
Old 03-24-12, 10:21 PM   #15
rrohbeck
Member



Join Date: Oct 2011
Location: Orange County, CA

 
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
rrohbeck is offline   QUOTE Thanks

Post Reply New Thread Subscribe


Overclockers Forums > Software > Alternative Operating Systems
Alternative Operating Systems Linux, Mac, Unix Operating Systems and Applications
Forum Jump

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Mobile Skin
All times are GMT -5. The time now is 07:42 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
You can add these icons by updating your profile information to include your Heatware ID, Benching Profile ID or your Folding/SETI profile ID. Edit your profile!
X

Welcome to Overclockers.com

Create your username to jump into the discussion!

New members like you have made this the best community on the Internet since 1998!


(4 digit year)

Why Join Us?

  • Share experience
  • Max out your hardware
  • Best forum members anywhere
  • Customized forum experience

Already a member?