I am running into the below issue.

I have two folders: AD-VM and Jump-VM

In each of these folders, the contents are:

-rw-------. 1 root root  20G Jun 28 18:27 AD-VM-flat.vmdk
-rw-------. 1 root root 8.5K Jun 27 16:07 AD-VM.nvram
-rw-------. 1 root root  543 Jun 27 16:07 AD-VM.vmdk
-rw-r--r--. 1 root root    0 Jun 27 16:07 AD-VM.vmsd
-rwxr-xr-x. 1 root root 2.6K Jun 27 16:07 AD-VM.vmtx

-rw-------. 1 root root  20G Jun 27 16:16 Jump-VM-flat.vmdk
-rw-------. 1 root root 8.5K Jun 27 16:16 Jump-VM.nvram
-rw-------. 1 root root  545 Jun 27 16:16 Jump-VM.vmdk
-rw-r--r--. 1 root root    0 Jun 27 16:16 Jump-VM.vmsd
-rwxr-xr-x. 1 root root 2.7K Jun 27 16:16 Jump-VM.vmtx

I am trying to compress each into a tar gunzip archive. I used:

tar -xzf AD.tar.gz AD-VM/*

tar -xzf Jump.tar.gz Jump-VM/*

After compression, I decompress on target and I only get the flat.vmdk The other files are not available.

So I tried,

tar -xf AD.tar AD-VM

It archived the folder and I was able to see all the files. Then

gzip AD.tar.gz AD.tar

Again, it only ends up with the flat file.

Basically, my vmtx and other files are not available post decompression.

  • There are limitations of tar. I see 20GB file in your directories. Better try zip – Romeo Ninov Jun 28 '17 at 13:32
  • Ah, was not aware tar had limitations. I will do a good old zip then. Thank you. – suhas savkoor Jun 28 '17 at 13:35
  • 2
    @RomeoNinov Um... I'm currently working with tar archives that (when compressed with bzip2) are larger than 500 GB. A 20 GB file is not an issue for tar. – Kusalananda Jun 28 '17 at 13:45
  • @Kusalananda, the limitations are not (in linux) with the size of archive but with the size of files in it (IMO) – Romeo Ninov Jun 28 '17 at 13:55
  • 1
    @RomeoNinov GNU tar version 1.12.64 or later will support files inside the archive of sizes up to 68 GB. Reference: answers.google.com/answers/threadview?id=25116 – Kusalananda Jun 28 '17 at 14:04

With tar, -x is for extracting files from an archive, while -c is for creating an archive.

You said you tried the following to create the archives:

tar -xzf AD.tar.gz AD-VM/*
tar -xzf Jump.tar.gz Jump-VM/*

This should probably have been

tar -czf AD.tar.gz AD-VM
tar -czf Jump.tar.gz Jump-VM

Notice the -c instead of -x and that /* is not needed if you want to archive all files in the named directory.

Also, the command gzip AD.tar.gz AD.tar makes little sense. Why would you try to compress AD.tar.gz? To compress AD.tar to AD.tar.gz, just use

gzip AD.tar

Note that using tar with -z creates a compressed archive, so using gzip to compress it would not be necessary.

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.