Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Ordering files inside tar created from bash

Any idea how to tar files in a specific order. I know it sounds weird at first, but hear me out. An OVA file is essentially a tar file but with a specific order. Tar is commonly used to create the file, but in order for the OVA to be recognised by HyperVisors like VMware, the files inside the OVA must be ordered in a very specific way. The .ovf file MUST be first in the OVA and the other files must appear in the order they are listed inside the .ovf

Here's just a quick tree to help explain:

VM.ova--
       |
       |--VM.ovf
       |--VM.mf
       |--VM.vmdk
       |--VM.iso

That is the proper order. When I try to create an ova with tar it works, but the order is wrong. Here is how I am doing it. It's actually very basic.

tar -cvf VM.ova *

I just dive into the folder containing all the contents that need to be added to the OVA and run the tar command. Please help me order these files correctly. If we can't figure this out, the VM will never work with any HyperVisor. Thank you!

* UPDATE *

Currently the order that tar does by default is: vmdk, iso, mf, ovf

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The issue is that you're just using a glob, *, to list the files. The glob expands immediately, before tar ever sees it, so what tar really sees is:

tar -cvf VM.ova VM.iso VM.mf VM.ovf VM.vmdk

Because under normal* circumstances globs expand lexically in the C collation locale. If the order is important you can list the files manually:

tar -cvf VM.ova VM.ovf VM.mf VM.vmdk VM.iso

or use brace expansion to save some typing

tar -cvf VM.ova VM.{ovf,mf,vmdk,iso}

*It's possible for a glob to expand in a different order if you mess with your LC_* vars, but I'm making some assumptions here.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!