Skip to content
Patineboot edited this page Oct 31, 2022 · 20 revisions

Elephant Backup Wiki

Snapshot algorithm

The Take and Destroy Snapshot Strategy.

Take a snapshot every 1 hour. Keep the previous snapshots:

  • A 1-hour snapshot for 24 hours.
  • A 1-day snapshot for 30 days.
  • A 1-week snapshot for 104 weeks.

The Keeping-Snapshots Algorithm.

Launch a program every 1 hour with a timer.

When launched:

  1. Take a snapshot.
  2. Separate the previous snapshots with young, middle, and old generations:
    • Young: within the previous 24 hours.
    • Middle: last 24 hours to last 30 days.
    • Old: last 30 days to the infinity past.
  3. Destroy snapshots of the Middle generation:
    1. The current time is the infinity past.
    2. Find-Earliest: Find the earliest snapshot from the current time to the future and KEEP the found snapshot.
    3. Move the current time to the time when the found snapshot was created.
    4. Spend the Keep-Interval time. Hint: The current time moves.
    5. Go to Find-Earliest if the current time is in the generation.
    6. Destroy no-keep snapshots in the generation.
  4. Destroy snapshots of the Old generation:
    1. The same process as the Middle generation.
    2. Destroy the snapshots of more than 104 from the near time.

Keep-Interval: Middle is 1 day, Old is 1 week.

Snapshot Name

Elephant Backup has the snapshot name format.

elephant-<year>-<month>-<day>-<hour munite second>

e.g., the name of snapshot is elephant-2022-08-30-120031 when you take a snapshot at 12:00:31 on 2022/AUG/30.

Log

Create the log file with:

  • the /var/log/elephant-backup.log path.
  • the permission which normal users write.

Misc

npm's npm-run-script

npm's npm-run-script does not launch under the super user.

npm-run-script means not only npm run start, but also npm start.

See the @baco16g's at Yappli, inc. repot : https://tech.yappli.io/entry/npm7_douser.

Useful command

  • Destroy many snapshots:

    e.g. ZFS filesystem: pool1, ZFS snapshot: pool1@elephant with followed the time string.

    zfs list -t snapshot pool1 -o name  | grep pool1@elephant | xargs -I {} sudo zfs destroy -r {}

Install Nodejs

Install node.js on Ubuntu Linux.

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Uninstall node.js on Ubuntu Linux.

sudo apt-get purge nodejs
sudo rm -r /etc/apt/sources.list.d/nodesource.list

See Installing Node.js via package manager on other platforms.

TODO

  • NAS storage with ZFS RAID5
    1. Attach the Crucial MX500 to the media server.
    2. Update the Crucial MX500 firmware, after building the NAS storage with ZFS RAID5.