Author Topic: backup and restore using zip  (Read 13198 times)

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1074
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
backup and restore using zip
« on: October 20, 2017, 04:20:31 am »
For years, well really decades, I've used zip and unzip to backup and restore bootable volumes.

Now with ArcaOS, it doesn't work.

I use zip -qrS to backup and unzip to restore.

Now that doesn't work because \usr is full of symbolic links that get replaced by files.

This make rpm/yum stop working.

Does anyone have an alternative, or better options for zip that backup and restore symbolic links?
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5098
  • Karma: +117/-1
    • View Profile
Re: backup and restore using zip
« Reply #1 on: October 20, 2017, 05:12:45 am »
Quickly testing, 7z seems to preserve symlinks. You might want to test.

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1604
  • Karma: +4/-2
    • View Profile
Re: backup and restore using zip
« Reply #2 on: October 20, 2017, 05:59:28 am »
I use -9yrS. -y is supposed to handle symlinks as a standard file. That part seems to work, although I haven't tested everything.

Right now, I am concerned because -S (include system and hidden files) isn't doing what it says it is supposed to do. As a work around, I do ATTRIB -H -S os2* in the root of the boot drive before ZIP, and  (optionally) ATTRIB +H +S os2* again after. There are a few other SH files, but they are nothing to worry about.

FWIW, I have formatted a boot drive, and UNZIPed a backup into it, many times. It always worked, until -S quit working. By using ATTRIB, it works again.

I have also been looking at 7z as an alternative. It compresses better, and I copy the backups to USB sticks, which seem to be getting smaller, and slower, as time goes on.  :(

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1074
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: backup and restore using zip
« Reply #3 on: October 20, 2017, 10:39:26 am »
How does 7z work for drive letters? For example the following backs up the C: drive using zip.

zip -qryS drivec.zip c:

The following does nearly nothing.

7z a drivec.7z c:

What is the 7z command to back up the whole drive? (and why isn't it documented in the p7zip package?)
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: backup and restore using zip
« Reply #4 on: October 20, 2017, 10:50:33 am »
How does 7z work for drive letters? For example the following backs up the C: drive using zip.

zip -qryS drivec.zip c:

The following does nearly nothing.

7z a drivec.7z c:
Without being able to test: I guess that 'c:' matches no folder or file. I would try 'c:\' or 'c:\*' next.

ivan

  • Hero Member
  • *****
  • Posts: 1603
  • Karma: +20/-0
    • View Profile
Re: backup and restore using zip
« Reply #5 on: October 20, 2017, 02:44:41 pm »
7zip does things in its own way which isn't the way we are used to.

Good luck making heads or tails out of that for anything more complicated than compressing a few files for storage.

A manual for the command line version we have appears at https://info.nrao.edu/computing/guide/file-access-and-archiving/7zip/7z-7za-command-line-guide

 

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1074
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: backup and restore using zip
« Reply #6 on: October 20, 2017, 04:08:21 pm »
How does 7z work for drive letters? For example the following backs up the C: drive using zip.

zip -qryS drivec.zip c:

The following does nearly nothing.

7z a drivec.7z c:
Without being able to test: I guess that 'c:' matches no folder or file. I would try 'c:\' or 'c:\*' next.

Why can't you test?

As long as the c: drive exists, c: may refer to the root. I suspect there isn't really full drive letter support in 7z.

None of the suggestions work. The following works, but I'm still curious how to do it in one line.

c:
cd \
7z a d:ArcaOS-C.7z \

It's not important to the conversation about how 7z syntax works, but 7z is a better compressor.

ArcaOS-C.zip 1,785,138,333 bytes
ArcaOS-C.7z 1,283,110,828 bytes

The number of files is not consistent between the two archives. I don't know why.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: backup and restore using zip
« Reply #7 on: October 20, 2017, 09:15:39 pm »
Why can't you test?
I'm now back at home.

I suspect there isn't really full drive letter support in 7z.
Indeed. Drive specs were simply ignored. Moreover, forward slashes have to be used. This doesn't work:
Code: [Select]
e:
cd \var
7z a drivee.7z \

This works:
Code: [Select]
e:
cd \var
7z a drivee.7z /

This works as well:
Code: [Select]
e:
cd \var
7z a drivee.7z /*

That looks like a bug.

OS4User

  • Sr. Member
  • ****
  • Posts: 406
  • Karma: +10/-0
    • View Profile
Re: backup and restore using zip
« Reply #8 on: October 20, 2017, 09:51:41 pm »

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1074
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: backup and restore using zip
« Reply #9 on: October 20, 2017, 10:35:17 pm »
From my testing zip 3.0

zip -qryS drivec.zip c:

does make a good backup that works with symlinks (i.e. yum still works after restore)

A restore of the backup I did with 7z does not work; it cannot find the desktop. The desktop seems to be restored, but ArcaOS can't use it.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1604
  • Karma: +4/-2
    • View Profile
Re: backup and restore using zip
« Reply #10 on: October 21, 2017, 01:06:26 am »
Quote
zip -qryS drivec.zip c:

does make a good backup that works with symlinks (i.e. yum still works after restore)

Be aware, that ZIP and UNZIP,  as supplied by RPM/YUM, don't work without some of the DLLs from the %UNIXROOT% directory structure. You do need those versions of the program, to be able to handle files (in and/or out) that are larger than 2 GB.