How to properly backup aptly and sym/hard links

224 views
Skip to first unread message

James Chiu

unread,
Apr 9, 2021, 3:10:32 PM4/9/21
to aptly-discuss
Hello all,

I'm relatively new to aptly world so please forgive my n00b question.

My goal: backup Whatever aptly related (data/symlink/hard link/etc) on an existing aptly host and restore it on a newly provisioned host withOUT breaking aptly functionality.

After some doing some research in this group, looks like it's relatively easy:

From Bestway to backup aptly

Q: we have multiple local repos, published as components locally and to s3.

Currently I´m wondering if the s3 publish is enough as a "backup strategy". Or if there are some best practices what exactly and how to backup the repository?

A: you can always backup aptly root with anything which can detect and correctly backup/restore hardlinks (just filesystem contents)

From how to backup

Q: Whats the right way to backup aptly?

A: To do proper aptly backup, it's enough to backup aptly root dir (~/.aptly) and config (~/.aptly.conf). Backup tool should be smart enough to detect hardlinks between pool/ and public/ directories contents.



However, due to the way whoever configured aptly host, our aptly host does not store anything locally and uses NFS mount & symlink approach instead.

Here is the ls under aptly root directory, both "db" and "pool" are symlinked to NFS drive:
/aptly#  ls -lri
total 4
3586850 drwxr-xr-x 2 root root 4096 Oct 22  2019 public
3586849 lrwxrwxrwx 1 root root   57 Oct 22  2019 pool -> /ERepos/vn00/Internal/Repos/factories/apt-mirror/pool
3586848 lrwxrwxrwx 1 root root   55 Oct 22  2019 db -> /ERepos/vn00/Internal/Repos/factories/apt-mirror/db

cd into public, there are more symlinks:
/aptly/public#  ls -lri
total 4
3586852 lrwxrwxrwx 1 root root 52 Oct 22  2019 pub-depot -> /ERepos/vn00/DataFiles/AB/pub-depot/apt/mirror
3586851 lrwxrwxrwx 1 root root 76 Oct 22  2019 priv-depot -> /ERepos/vn00/Internal/Repos/repodepot/priv-depot.xyz.com/apt/mirror

My question is: with this kind of setup, would "back up aptly root directory" still a good approach in terms of backing up aptly? Is there anything other than symlinks that I need to concern about?

Thank you in advance,
James

James Chiu

unread,
Apr 9, 2021, 9:55:55 PM4/9/21
to aptly-discuss
Hello again, I should probably update my question after some experiment.
Looks like the hard links are being backed up and restored after untarring it. 

However, the inodes are changed...

### Old aptly host

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# sha256sum yarn_1.0.1_all.deb
19934a1c4a77f30a59de40f4879416c734c46e029d135e9bbc6b2e43c30bf590  yarn_1.0.1_all.deb

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# ls -li yarn_1.0.1_all.deb
3538978 -rw-r--r-- 2 root root 641352 Apr 10 01:30 yarn_1.0.1_all.deb

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# ls -li /aptly/pool/19/93/4a1c4a77f30a59de40f4879416c7_yarn_1.0.1_all.deb
3538978 -rw-r--r-- 2 root root 641352 Apr 10 01:30 /aptly/pool/19/93/4a1c4a77f30a59de40f4879416c7_yarn_1.0.1_all.deb

### New aptly host, after restoring (untar) the backup data

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# sha256sum yarn_1.0.1_all.deb
19934a1c4a77f30a59de40f4879416c734c46e029d135e9bbc6b2e43c30bf590  yarn_1.0.1_all.deb

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# ls -li yarn_1.0.1_all.deb
1179760 -rw-r--r-- 2 root root 641352 Apr 10 01:30 yarn_1.0.1_all.deb

/aptly/public/pub-depot/yarn/xenial/test/pool/main/y/yarn# ls -li /aptly/pool/19/93/4a1c4a77f30a59de40f4879416c7_yarn_1.0.1_all.deb
1179760 -rw-r--r-- 2 root root 641352 Apr 10 01:30 /aptly/pool/19/93/4a1c4a77f30a59de40f4879416c7_yarn_1.0.1_all.deb

Is there any approach to backup and restore (include the hard links) or republishing is the only option left?

Thanks again,
James
Reply all
Reply to author
Forward
0 new messages