Backup & re-install OS

This is my straightforward procedure for backing up my data on Debian based Linux, before a clean re-install of the OS/Distro.

Although there are normally update methods available for Linux distros, sometimes they don't work, or maybe they get complicated by problems with existing packages which may be incompatible or corrupted in some way.

Download OS

Download required version of OS.

Create bootable USB stick; this can often be initiated from the file manager by right-clicking on the downloaded image file and selecting 'Make bootable USB stick' from the context menu.

Installed packages

In a terminal run:-

 aptitude search '~i' > /home/<user>/installed_apps.txt

This will create a record of installed applications/packages and save in the specified text file. It will be useful in restoring programs on the computer after a re-install.

Backup the Home drive

Connect suitable USB drive or memory stick to contain backup files.

Using the file manager, enable 'show hidden files' then select dual windows; one for your /home/<user> directory (replace <user> with actual name, e.g. steve), and second window to display the backup drive.

Create a new directory on backup, e.g. steve_25Feb2026

Note: 1st window should be displaying the contents of /home/steve, not /home

Select all files on /home/steve ensuring hidden files & folders are also included.

Copy to backup USB drive folder in second window.

This may take an hour or two!

When complete, remove all USB memory devices.

Boot linux from USB

Plug in bootable memory stick with required Linux version.

Restart computer while repeatedly pressing/releasing the key which forces the computer into BIOS screen. If key unknown, start by pressing/releasing F2, F9 & F10 in a rapid sequence. Or, if you know the make & model of computer, ask AI.

Test the Linux OS, and when happy, click the install icon, often found on the desktop.

Set stuff as requested, usually; Language, Keyboard layout, Time-zone, Wifi, Media codecs, Erase disk & install Linux, User name, Password...

Once complete, follow instructions regarding removal of USB stick & rebooting.

Use the Update Manager to perform any new updates.

Restore your data

Reconnect backup USB device.

In file manager, select twin windows; first displaying USB drive with backup folder contents displayed. Second with /home/<user> directory displayed.

Enable 'Show hidden files'

Copy contents from backup directory to /home/<user>

Use Merge & Apply this action to all files when duplicate folders are found.

Test that files are accessible, email finds your Profile & so on.

Restore programs/applications/packages

Create list of software on new OS installation;

In a terminal run:-

 aptitude search '~i' > /home/<user>/installed_apps_new.txt

Install Synaptic Package Manager

Install a file comparison program; e.g. Meld

Compare the 2 files; installed_apps.txt & installed_apps_new.txt

Add any required packages via Synaptic Package Manager.

That's it!


Suggestion:-

Periodically run in terminal: 

 aptitude search '~i' > /home/<user>/installed_apps_<date>.txt

...then backup data in /home/<user> to a backup USB drive

No comments:

Post a Comment