OS backup / restore process , alternative method

Moderator: Forum moderators

Post Reply
darksun
Posts: 176
Joined: Tue Dec 19, 2023 10:12 am
Has thanked: 55 times
Been thanked: 69 times

OS backup / restore process , alternative method

Post by darksun »

Since many years of experience ( = failures ) in this area I am using my personal way to backup and restore my OSs (desktop and mobile too, same methodology applies).

The "standard" way of managing operating system's backups and restores them involve the usage of dedicated software and procedures, with the real and/or potential downsides of them:

  • being buggy

  • becoming discontinued

  • creating big backup file(s), of which the majority are bloat, as they contain operating system and installed software' files that can be easily re-downloaded post fresh installation

  • needs to be done again and again (backup) when a chosen event occurs (OS update, major change in your custom settings) ; this is media storage space and time consuming

  • there are other real/potential downsides but I would stop here

My method
I want to have a easy, scalable, portable, essential way to back up and restore that not only avoid the above mentioned but also has other benefits.
All names below are invented, you can adapt to your own need and please.
I have/create a folder called, for example, mylinux

into that folder I put / save / export, all your configuration files you use on your (1) OS and with your (2) additional software installed that needs to me added/amended AFTER fresh installation.

Code: Select all

~/mylinux$ ls
bookmarks.html  softwareB.conf  stubby.yml
diary.txt       sofwareA.conf   mywallpaper.jpg
urls		config	jwm

the "magic" is done by using text file where you can list and keep notes of all the changes you adopt POST fresh installation.

Let's name it for example name diary.txt

Like I said in there you list, step by step, wisely in chronological order if it is important, everything you do post fresh (new) installation of your OS

eg: software you install, configuration you amend, things you tweak and so on.

Into diary.txt I put BOTH (a) terminal commands for a simple copy/paste into the terminal and AS WELL AS (2) instructions of things to do POST fresh installation.

example of a diary.txt:

Code: Select all

LXTERMINAL set palette: tango

set mywallpaper.jpg

# apt install ffmpeg keepassxc qpdfview aria2 curl newsboat w3m bmon iftop nethogs handbrake libimage-exiftool-perl mpv webp webp-pixbuf-loader mp3wrap tofrodos htop ncdu units p7zip-full poppler-utils recordmydesktop torbrowser-launcher

https://mullvad.net/en/download/browser/linux
set default web browser "run-as-spot mullvad-browser"

restore configuration files softwareA.conf

restore configuration files softwareB.conf

import jwm toolbar settings (exported and saved into mylinux folder)

### append to .bashrc ###
unset HISTFILE
set +o history
alias ls='ls --color=auto'
alias ll='ls -lh'
alias whatsmounted='fdisk -l;blkid; lsblk ; parted -l ; mount | column -t ; df -h'
alias speecy='neofetch ; inxi -Fx ; lshw -short ; lsusb ; hwinfo --short ; lspci ;lsscsi'
alias temperatures='watch sensors'
alias pdfcompress='ps2pdf -dPDFSETTINGS=/ebook input.pdf outputpdf'
alias shred='shred -zuvf'
alias history_apt='less /var/log/apt/history.log'
alias myippublic='curl https://ifconfig.co/json'
alias myipprivate='ip addr show ; iwconfig ; iwgetid; route -n ; ip route show ; cat /etc/resolv.conf ; arp -av'
alias x='exit'
alias p='poweroff'
alias r='reboot'
alias s='echo -n mem > /sys/power/state && xlock'
alias easy_dd='cat "image_file.iso" | dd of=/dev/sda bs=1M conv=fsync status=progress oflag=sync'
alias PUPSTATE='less /etc/rc.d/PUPSTATE'
alias sys5init='service --status-all'
alias DISTRO_SPECS='cat /etc/DISTRO_SPECS'
alias torbrowser-launcher='run-as-spot torbrowser-launcher'
### .bashrc EOF ###

# apt install stubby
# mv stubby.yml /etc/stubby/
# echo "stubby >/dev/null 2>&1 &" >> /etc/rc.d/rc.local
# configure network manager's nameserver to 127.0.0.1 ,for IPv6 ::1
# stubby &

# newsboat
- restore .newsboat urls and config

[manual install]
# cd
# wget git.io/trans && chmod +x ./trans
# curl -sSL https://raw.githubusercontent.com/aandrew-me/tgpt/main/install | bash -s /usr/local/bin
# curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/bin/yt-dlp && chmod a+rx /usr/bin/yt-dlp
- download https://github.com/macvk/dnsleaktest/blob/master/dnsleaktest.sh
# mv trans dnsleaktest.sh /usr/bin/

# leafpad /etc/w3m/config
manually set:
use_history 0
use_cookie 0
display_image 0

# redshiftgui-64
https://forum.puppylinux.com/viewtopic.php?p=3107
copy it into /root/Startup/

There are so many benefits on doing in this way that I should write a long list. Some are:

  • no need of extra , dedicated software. just a text editor. that is all.

  • as long as I keep my diary.txt up to date, once populated, I am done! and I read/update it occasionally, either post fresh OS installation or when there is an important change I want to persist next time I do a fresh OS re installation

  • my backup file is a tiny fraction, in terms of HD space taken

  • I can 7z the folder and backing it up basically anywhere, anytime, and read/amend it everywhere, as diary.txt is a text file

  • my backup file does not contain many GB of files that are kept for no reasons, because the OS ISO and additional software can be easily re-downloaded, no need to be part of the backup.

Of course keepign the OS as close as defaults post installation simplify this process, but I anyway like to keep things as much close as defaults and amend things only when really necessary.

EDIT: grammars and sentence adjustments to make concepts clearer.

Last edited by darksun on Sun Jan 19, 2025 10:53 am, edited 1 time in total.
User avatar
bigpup
Moderator
Posts: 7324
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 964 times
Been thanked: 1624 times

Re: OS backup / restore process , alternative method

Post by bigpup »

apt commands are only going to work if the Puppy version has apt package manager.

Right now only a few do have it.

what if you do not have apt?

Installing apt is not something easily done.
The Puppy version needs to have it already there to use.
Compiled into the Puppy version build, when it was produced.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

darksun
Posts: 176
Joined: Tue Dec 19, 2023 10:12 am
Has thanked: 55 times
Been thanked: 69 times

Re: OS backup / restore process , alternative method

Post by darksun »

It is the HOW TO idea, the methodology, I wanted to share.

Of course you install your software according to your operating system, regardless which one it is.

I apply my method explained in my first post to my Debian based Linux distribution and to my Android mobile phone, but my method can be applied to any OS regardless, including Windows , Mac and so on.

I use my method since many many years, regardless the OS.

Despite there are some case scenario my method is not applicable (not in my cases eheh) I cannot see any point of failure, I have not encountered a single issue since I started using and perfecting it, since more than a decade.

The OS "backup" is just few Kb's depending of what you wish and want to have restored on the new fresh OS re-installation.

My "folder.7z" containing my "diary.txt" and all configuration files (Firefox bookmarks, Newsboat config, w3m config and so on and on) is only 80Kbs.
After I "re-install" a fresh installation of my Linux Desktop I follow my diary.txt, in 10 minutes I have the restored operating system.

When I want to update my "backup" I do not need to re-create the image of my current OS, using a dedicate software, creating an image file output of several hundreds of MBs or GBs, and so on. I only need to open with a text editor my diary.txt and amend what I wish to do after my next new fresh installation, that is all.
How fantastic is it?

JusGellin
Posts: 757
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 93 times
Been thanked: 92 times

Re: OS backup / restore process , alternative method

Post by JusGellin »

@darksun
I'm always interested in better ways to do things, especially backups.

But I'm completely lost for how you are doing this.
It may be that this is way too advanced.

How do you determine what goes into the diary.txt?

It seems that every time you add a program or change a setting you have to know more
about the in-depth workings of how this is done.

Thanks

darksun
Posts: 176
Joined: Tue Dec 19, 2023 10:12 am
Has thanked: 55 times
Been thanked: 69 times

Re: OS backup / restore process , alternative method

Post by darksun »

it is much simpler than you think.

I gave it the name of "diary" , it is just a name.
The method is to have a text file , a file.txt when AFTER a fresh new install you manually take note of your personal changes and configuration . example:

A) you do a fresh new installation of your operating system and boot it up, then
- disable this
- uninstall that
- install A B C D
- export firefox configuration and bookmarks files
- change the configuration of this software
- software you add and or remove from the autorun at start up

so you create your text file with whatever name, just a text file

Code: Select all

diary.txt

it would contain the above, you basically will write those personal changes, keep track of those personal things you do post fresh installation.

Your text file name.txt would of course contain

Code: Select all

- disable this
- uninstall that
- install A B C D
- export firefox configuration and bookmarks files
- change the configuration of this software
- software you add and or remove from the autorun at start up

For example In this text file you can put your aliases you set into your .bashrc fox example.

Code: Select all

- disable this
- uninstall that
- install A B C D
- export firefox configuration and bookmarks files
- change the configuration of this software
- software you add and or remove from the autorun at start up

append in.bashrc (copy paste at the end of my .bashr)
alias blabla='my alias'
alias bbbb='my alias'

Those are just example, you need to understand the methodology.

All those personal things and choices you adopt AFTER a new fresh OS installation, you keep a log into your text file, you manually write what you do, eg copy your terminal commands you always you do post OS installation.

- sometimes is more convenient to put this modifications directly into this diary, log, chronicles, call it how you want, it is a text file. for example if you always install or want to make sure it is installed software you tend always to use you could write in that text file

# apt install softwareA software B softwareC
(you can adapt it based on your operating system and your packet manager, even a plain "install softwareA softwareB" and then you manually do that.

- sometimes is more convenient to export software/system configuration and keep those files inside the same folder where you keep your text file (eg. web browser bookmarks, .config files of something you changed post installation and want to restore next time you do a fresh installation)

B) now you have a directory with your "diary.txt" and files of what you wish to make sure you restore next time you do a fresh installation.

C) to RESTORE your system you just need to do a fresh new installation of your operating system (Puppy Linux, Windows, Mac, Slackware, Android, whatever).

then
you access your directory, in there you already have your diary.txt containing your choices, preferences, software and so on, and as well as configuration of things you wish to restore.

You plainly need to follow it and re-do what you annotated into your text file.

I hope I made myself bit clearer. Now a re-read of my fist post would clarify you even more.

d-pupp
Posts: 398
Joined: Tue Nov 22, 2022 9:11 pm
Location: Canada
Has thanked: 233 times
Been thanked: 70 times

Re: OS backup / restore process , alternative method

Post by d-pupp »

@darksun I do something like this only I have made my list into shell scripts.
After a fresh frugal install I open a terminal and run the scripts. In my case 2 scripts. 1 for as root and the other as user spot. (Because I'm using Dpup11)
I watch the output to make sure everything ran without error and I'm done except for a couple of things that I haven't added to the scripts yet.

darksun
Posts: 176
Joined: Tue Dec 19, 2023 10:12 am
Has thanked: 55 times
Been thanked: 69 times

Re: OS backup / restore process , alternative method

Post by darksun »

d-pupp wrote: Sun Jan 19, 2025 5:06 pm

@darksun I do something like this only I have made my list into shell scripts.
After a fresh frugal install I open a terminal and run the scripts. In my case 2 scripts. 1 for as root and the other as user spot. (Because I'm using Dpup11)
I watch the output to make sure everything ran without error and I'm done except for a couple of things that I haven't added to the scripts yet.

Good job; having a script to automate everything is ok but I do not like it. For several reasons I do it in a manual way.
What is important is to have the job done using this approach, this method, and have all the benefits I mentioned in my first post, and more.

geo_c
Posts: 2958
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 2279 times
Been thanked: 915 times

Re: OS backup / restore process , alternative method

Post by geo_c »

darksun wrote: Sun Jan 19, 2025 5:14 pm
d-pupp wrote: Sun Jan 19, 2025 5:06 pm

@darksun I do something like this only I have made my list into shell scripts.
After a fresh frugal install I open a terminal and run the scripts. In my case 2 scripts. 1 for as root and the other as user spot. (Because I'm using Dpup11)
I watch the output to make sure everything ran without error and I'm done except for a couple of things that I haven't added to the scripts yet.

Good job; having a script to automate everything is ok but I do not like it. For several reasons I do it in a manual way.
What is important is to have the job done using this approach, this method, and have all the benefits I mentioned in my first post, and more.

I do this same thing, I make lists of installed packages, linked data and configs, window manager configs, the whole nine yards, and then run a script on a fresh system when I want to load up a new build.

But I would consider this more of system setup, or system creation tool than a backup/restore procedure. Just by definition I would think of a backup as being the actual system files copied rather than freshly installed files.

geo_c
Old School Hipster, and Such

darksun
Posts: 176
Joined: Tue Dec 19, 2023 10:12 am
Has thanked: 55 times
Been thanked: 69 times

Re: OS backup / restore process , alternative method

Post by darksun »

geo_c wrote: Sun Jan 19, 2025 5:28 pm

But I would consider this more of system setup, or system creation tool than a backup/restore procedure. Just by definition I would think of a backup as being the actual system files copied rather than freshly installed files.

I see your point. I look at the wished outcome and I see that with this method I restore all my OS and software configurations, backing up my config files and list of amendments I adopt post fresh installation. I then prefer to see it as a backup and restore method , because of what I obtain. But it is just a name, the important is the goal we aim to achieve.

In my case I have a 7z folder with my "diary.txt" and config files (around 80Kb only!) , I use its content to restore my system post fresh installation, and in 10 minutes I have my OS restored.
No more GBs of HD space taken (including huge data that are bloat and not needed to be backed up as the OS ISO and added software can be always reinstalled after the new fresh OS installation) and long time taken in using dedicated (and sometimes not compatible)software to backup and restore OS images. No points of failure, they are history.

JusGellin
Posts: 757
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 93 times
Been thanked: 92 times

Re: OS backup / restore process , alternative method

Post by JusGellin »

@darksun
Thanks for the explanation.

It's definately something I need to get into the habit of doing.
I like how it keeps up with what you do with the system and you do it right there on the system you are working on.
I've been so haphazard with having a bunch of notes spead all over and not using them when trying an install.

Post Reply

Return to “Tips & Tweaks”