Forum Discussion

Wallace1's avatar
Wallace1
Icon for Nimbostratus rankNimbostratus
Sep 25, 2015

Manipulating files in a UCS File

I understand that the UCS file is just a tar of the bigip configuration. So using Tar, I am able to list out the contents of the UCS, but I am unable to delete individual files.

 

When I do:

 

tar --list --file=prestage.ucs config/bigip_base

 

I get:

 

config/bigip_base.conf

 

But when I try to delete that directory, it doesn't work:

 

tar --delete --file=prestage.ucs config/bigip_base.conf

 

I get the error:

 

tar: This Does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: config/bigip_base.conf: Not found in archive tar: Error Exit delayed from previous errors

 

I know I can extract the ucs into a directory, change the files I need to change and then re-compress them and restore the UCS, but I wanted a easier way out.

 

Thanks...

 

5 Replies

  • Why are you trying to delete the base config from the UCS? Maybe I can help achieve your goal without having to edit the ucs.

     

  • I am trying to create a script to make test boxes using a VE. So I would need to keep the Base config, the user accounts and any routing in place.

     

    Anything you have would be great. Thanks...

     

  • The only issue there is we are creating UCS' in production. So it would be easier to use those. Thanks...

     

  • I got it, just took a little digging...

     

    You have to decompress the UCS file first: Because gzip doesn't understand what UCS is, you have rename the file: cp prestage.ucs prestage.tar.gz

     

    Next you can decompress this file: gzip -d prestage.tar.gz

     

    It creates a new file: prestage.tar

     

    Now you are able to manipulate these files and save them as shown below: tar -f prestage.tar --delete config/bigip_base.conf

     

    tar tvf prestage.tar config/bigip_base.conf tar: config/bigip_base.conf: Not found in archive

     

    tar rvf prestage.tar /config/bigip_base.conf tar: Removing leading `/' from member names /config/bigip_base.conf

     

    Repackage this archive:

     

    gzip prestage.tar

     

    Rename this archive: mv prestage.tar.gz prestage.ucs

     

    Now you are able to load the ucs file with the bigip_base.conf from you lab device.