1

I'm trying to create a zipped tar archive of all files on a centos 7 machine. I'm using this command:

sudo tar -cvzp --exclude=backup --exclude=swapfile -f /backup/archive/full-backup-$today.tar.gz  --one-file-system /

When I do this, I can perfectly untar the file on centos with tar -xvf However, the file is not readable in Windows (via winrar & winzip). I think it has something to do the way it was tarred.

Since I want to be able to recover some files in Windows, I would like to be able to open it in Windows.

THanks!

  • I would also exclude /dev, /sys, /srv, /proc. Though -p may already be disposing of many (all?) of them. – Alien Life Form Mar 12 '18 at 9:24
  • Duplicate of superuser.com/questions/234649/… – Gerald Schneider Mar 12 '18 at 9:25
  • @AlienLifeForm Thanks for the tip! @GeraldSchneider; I know how to extract a tar file. However, it's not working, so I believe it has something to do how I tar the files. – mitch2k Mar 12 '18 at 14:09
  • @AlienLifeForm -p, --preserve-permissions seems to be irrelevant. From man tar: extract information about file permissions (default for superuser). You're probably right about excluding these directories though. – yahol Mar 13 '18 at 6:46
  • @yahol You are indeed correct - I misread -p as --one-file-system (only root knows why) – Alien Life Form Mar 13 '18 at 17:07
1

On Windows, you could try 7zip - it works with .tar, .tar.gz files.
You can also zip and unzip files on Linux for better compatibility with Windows' zip.

|improve this answer|||||
  • Windows 1803 and later will include tar out of the box, so 7zip (or starting up WSL) will no longer be a requirement when handling .tar files. – the-wabbit Mar 12 '18 at 12:14
  • Hi, I've tried to use 7zip, but also there I get a message that the archive is corrupt – mitch2k Mar 12 '18 at 14:07
  • @mitch2k can you extract dirs from top level one by one, to see which one is causing trouble? Can you also try zip instead of tar on Linux and then extract it on Windows? – yahol Mar 13 '18 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.