View previous topic :: View next topic |
Author |
Message |
calicoman Apprentice
Joined: 18 Feb 2004 Posts: 171
|
Posted: Wed Dec 12, 2007 12:51 am Post subject: Redid partition table - cannot tar to proper part [SOLVED] |
|
|
I had my hdb drive partitioned as:
hdb1 vfat (a windows partition where I needed the faster drive for video capture)
hdb2 linux boot
hdb3 linux swap
hdb4 linux root
I decided I wanted to use the whole drive for Gentoo, so I tar'd the files in hdb2 and hdb4. I then re-partitioned the drive into hdb1, hdb2, hdb3 to use for boot, swap, and root. When I try to extract the files, it wants to create and mount the old partition number and then extract.
For example I want to tar the old hdb2 file into hdb1, but it creates /mnt/hdb2 and then extracts files into that directory.
How can I get the files to extract into the new partitons - I sure don't want to re-install everything or have to recopy millions of files!
Needless to say, a solution would be MOST welcome
Last edited by calicoman on Wed Dec 12, 2007 5:13 pm; edited 1 time in total |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Wed Dec 12, 2007 1:12 am Post subject: |
|
|
1. What were the tar commands you used to create the archives?
2. Please post the output of tar tf archive-filename | head for each of your archive files. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
calicoman Apprentice
Joined: 18 Feb 2004 Posts: 171
|
Posted: Wed Dec 12, 2007 1:44 am Post subject: |
|
|
From a Knoppix CD, I used the options tar -czvf and sent it to a linux partiton (hda2) on my other drive.
I think the syntax I used was tar -czvf old-gentoo_hdb2.tgz /mnt/data (or /mnt/hda2) I am not quite sure at this point, but I did get the tarred files to hda2.
Output for both files for tar tf file| head:
tar: this does not look like a tar archive
tar: skipping to next header
tar: archive contains obsolescent base-64 headers
Frank |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Wed Dec 12, 2007 4:15 am Post subject: |
|
|
calicoman wrote: | I think the syntax I used was tar -czvf old-gentoo_hdb2.tgz /mnt/data (or /mnt/hda2) I am not quite sure at this point, but I did get the tarred files to hda2. | Since you used the z (gzip archive) option, you'd need the same to list the contents: tar tzf filename | head. If your memory is correct I think I see the problem.
tar stores relative paths in the archive--relative to the current working directory when the command runs (unless you use the -C option). Thus I'd expect to see all the paths in your archive prefixed with mnt/data or mnt/hda2 (or similar, depending on what exactly you typed). When you extract the archive, tar is respecting those paths and putting files where you don't want them.
You can do one of two things: (1) make a mount point at the location tar expects, then mount the correct partition under it, or (2) tell tar to ignore the unwanted portion of all paths in the archive. The latter is easiest: simply add --strip-components=2 to your extract command. That removes two directory levels from the front of all paths, so for example mnt/hdb2/usr/bin/tar becomes usr/bin/tar, and files should land where they belong.
Be sure to also specify the p option (preserve permissions) when you extract the archive or you'll end up with a semi-borked system. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
calicoman Apprentice
Joined: 18 Feb 2004 Posts: 171
|
Posted: Wed Dec 12, 2007 5:10 pm Post subject: |
|
|
Thanks for the help time bandit. I sort of got things figured out overnight and pretty much did what you suggested although a little differently. What I did was to make a hdb2 directory under mnt and then mounted /dev/hdb1 /mnt/hdb2 and then tar -xzvf <file>.tgz -C /. This got everything in the correct place.
This got everything in the right place and I am now doing this from my repartitioned drive. I did not include the -p option so I don't know if they are screwed up, but will check as soon as I send this.
Thanks again,
Frank |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|