HOWTO: Have fun with tar

Post anything on anything here

Moderator: Moderators

HOWTO: Have fun with tar

Postby C.Brutail » Sun Jun 03, 2007 8:47 am

While trying to transfer your system to another drive:

tar -cpf - /olddisk/* | tar -C /newdisk -xf -

Have fun. :(
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby divVerent » Sun Jun 03, 2007 9:27 am

What went wrong apart from what can be fixed by cd /newdisk/olddisk; mv * ..; cd ..; rmdir olddisk?

Never using tar for that... I prefer rsync -xvaSHP /olddisk/. /newdisk
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby C.Brutail » Sun Jun 03, 2007 9:30 am

Everything got overwritten by itself, but resulting files that contain no data. All of init scripts, the whole boot directory, everything.
I only hope ~ hasn't got damaged, so I can restore my settings.
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby dfkgmasdfnasodrg » Tue Jun 12, 2007 9:27 am

that rsync command looks really good, making a note of it

but can that be used for roots? e.g. will it ignore proc dev sys
dfkgmasdfnasodrg
Alien
 
Posts: 153
Joined: Sat Mar 04, 2006 4:21 pm

Postby ZyanKLee » Tue Jun 12, 2007 10:22 am

rsync has a feature to ignore certain elements given in a file

btw, when booting the system from a live-cd for this matter (might be a very good idea) there should be nothing at least in /sys, /proc - and what exists in /dev is needed to be there
Last edited by ZyanKLee on Tue Jun 12, 2007 10:24 am, edited 1 time in total.
ZyanKLee
Alien
 
Posts: 151
Joined: Sun Feb 18, 2007 8:58 pm
Location: Germany

Postby divVerent » Tue Jun 12, 2007 10:22 am

C.Brutail wrote:Everything got overwritten by itself, but resulting files that contain no data. All of init scripts, the whole boot directory, everything.
I only hope ~ hasn't got damaged, so I can restore my settings.


Why? Does tar do such things because /olddisk/ is an absolute path? I didn't expect tar x to be THAT bad... wouldn't that be a security hole when extracting tarballs from the internet? Or did /newdisk maybe not exist yet?
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby ZyanKLee » Tue Jun 12, 2007 10:28 am

tar --help:
-f, --file=ARCHIV Archivdatei oder Gerät ARCHIV benutzen

or in english:
-f, --file=ARCHIV use archiv file or device ARCHIV


perhaps that was the problem - you did not use a file, but a pipe (stdout - stdin)
ZyanKLee
Alien
 
Posts: 151
Joined: Sun Feb 18, 2007 8:58 pm
Location: Germany


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron