doing a backup of a whole notebook - procedures, commands for the terminal?

OP,

The best way to do what you want is with Rescuezilla or Foxclone.

Both create an image of your System which is stored on an external HDD or SSD. You can restore the image to an internal drive of the same size.
1763245378521.gif
 


What if you know the answer just take help of AI to write down the content then check whether it's ok or not, if needed edit here and there. What about this approach?

But the main concern should be whether I am helping or not. If there's something wrong (by AI or by human) , there are so many people who can correct this. But main intention is to help each other, isn't it?

You're not helping by quoting AI because it can be very wrong and the beginner becomes more confused.
You might want to look at what AI says about kernel 6.14...then you might understand.
1763246454297.gif
 
I wrote a Howto Clone piece a few days ago.

Why am I now unable to find it !

EDIT:
I found it. But not by using our wanky search facility, but by searching my own content

@dhubs, this works...read carefully to ensure it fits your needs and circumstances.

 
Last edited:
IMO the advantage of using timeshift is that it can do the backup from a running system, no need to boot from an external drive and do the backup from there. That takes three drives - the drive to be backed up, the drive to hold the backup, and the drive to boot from. Timeshift saves a restorable, bootable backup while the system is running normally.
 
IMO the advantage of using timeshift is that it can do the backup from a running system, no need to boot from an external drive and do the backup from there. That takes three drives - the drive to be backed up, the drive to hold the backup, and the drive to boot from. Timeshift saves a restorable, bootable backup while the system is running normally.

Have you tried Rescuezilla or Foxclone...because both have an advantage over Timeshift.

Rescuezilla and Foxclone apply compression to the created image and both have a Verify tool and you don't have to format the External HDD or SSD the image is saved to.

You only need a Flash Drive with Ventoy installed and an External Drive to save the Image to. The created Image can be put back on the same Internal Drive or a new Internal Drive of the same size should to first Internal Drive fail.
1763249290742.gif
 
I wrote a Howto Clone piece a few days ago.

Why am I now unable to find it !

EDIT:
I found it. But not by using our wanky search facility, but by searching my own content

@dhubs, this works...read carefully to ensure it fits your needs and circumstances.


It seems you have to use the Search to find the How-Tos.
1763249596139.gif
 
First search
2025-11-16_10-54.png

Result:.quite a few , but not the one that I want

Second search (changed the spelling of howto
2025-11-16_10-57.png

Result....just two answers,,,,nether of them are what I am searching for

Third Search

I copied and pasted the title from the article I wrote.....so the search term is accurate.
I ticked 'Serach title only'
by; Condobloke

Result: No result found

The content DOES exist !!!

 
Found the answer.
The search term needs to be: Clone not, :Howto Clone

Now, if some poor wretch comes here wanting to know how to clone one drive to another, or some such similar probel, what is he/she going to type into the search box ??

how to clone

the answer he will receive?

10 pages of assorted crap. Is he/she going to sort through that pile ?

Unlikely.

@Rob

@KGIII

@wizardfromoz
 
If the member goes to any subforum, in this instance, General Linux Questions, and clicks filters and chooses the howto prefix, I get the below

upF29ci.png


Now, while that may not be incredibly intuitive ...no matter what solution we use, there are going to be people who cannot follow the steps.

If we start a Q&A subforum, there would be a nightmarish amount of work for one or more unpaid volunteers to identify and catalogue the results, let alone keep it updated. I do not see it as viable.

That is just IMO, other Staff may differ.

Open to your suggestions, in Forum Assistance, my good friend. ;)
 
ood morning hello dear community, :)


well - i am working on the setup of a notebook - (erasing the old ubuntu ) and installing a new OS.

therefore i need to copy all the data.

how to proceed: how to copy (all!) the data from one notebook to a external drive
how to copy the data from one notebook to a external drive -

note: i want to move the whole data - i want to do a complete frehs install - therefore i need to save all /(!) the data:
how to achive that - how to get really each byte!?
a. with the bookmarks of the browser
b. the hidden data.
c.

are there some certain commands that ensure that i really get all the stuff!?

look forward to hear from you

Update some additional thoughts:

how do you find this idea: what if i just create a new folder in my /home called ‘Alltogther’ .
what if i do it like so: i firt copy / paste all the pre-existing folders into “Alltogehter”.

hmm - it would be great if i know a good command for the terminal

and subsequently:

well that said . i could then finally copy the so called " Alltogether-folder" into my backup location.
what do you say - i think that this solution is very interesting.


question: how would you do the job of coping all the data!?

look forward to hear from you:cool:

greetings
The issue, as presented in post #1 is to copy "all the data" and "each byte".
The answer to copying all the data, meaning each byte, is to clone.

@f33dm3bits however in post #6, asks the question whether you want to backup files in order to restore them later, to which there doesn't seem to have been a succinct answer yet.

There's a significant difference between cloning and backing up files. The foxclone website explains it in the following text from this document on its website: https://foxclone.org/downloads/foxcloneV50.pdf
Code:
Foxclone V50                                                                                                                            
Page 5 of 64                                                                                                                            

How should it be used?                                                                                                                  
2. It cannot be stressed strongly enough – a partition backup utility such as                                                           
foxclone or clonezilla or any other image backup tool should not be used as                                                             
your only backup tool.                                                                                                                  

3. A partition backup utility is there for disaster recovery:                                                                           
   * A failed or failing drive.                                                                                                         
   * An operating system borked (usually by the user) to the extent that it will                                                        
     no longer boot.                                                                                                                    

4. It should not be used as a daily backup tool, why?
   * It is a manual process, you cannot automate it, at some point you will
     forget to do it.
   * It is slow, you have to backup up complete partitions. There is no
     incremental or differential backup to speed things up.
   * It doesn’t understand files and folders, just partitions. Mess up a few
     files, you have to restore the entire partition probably overwriting
     newer files that were perfectly okay, potentially leaving you worse off.

Problem dependent, it can be a sledgehammer to crack a nut.

5. An image backup tool, such as foxclone, should be used in conjunction with a
file level backup tool(s). There are plenty of excellent Linux file backup
utilities, timeshift, backintime, luckybackup to name just three. These:
    * Are installed in your running system. You do not have to boot a
      separate operating system, e.g. from a USB stick. More convenient.
    * Can be automated to run daily or at whatever frequency you want.
    * Are incremental – they only backup files that are new or changed – so
      quick.
    * Allow you to restore individual files – just the ones you broke!

Use file level backup as your first line of defence.
Use image backup as your last line of defence.

Basically the essence is captured in the metaphor that sees cloning as a "sledgehammer to crack a nut".

Cloning can be an effective solution for disaster recovery, and also for copying a whole installation bit-by-bit to another suitable drive and then trying to have that second drive boot up the same or similarly to the original installation of which it is a copy.

In relation to backing up files, which is the central concern with backing up so that files are not lost and can be easily recovered, the economy and efficiency in the use of resources is greatly more optimal with use of appropriate back up tools, procedures and processes which do not involve cloning at all.

In considering the two examples for backing up mentioned in post #1, "the bookmarks of the browser" and the "hidden data", the following thoughts occur.

To take the firefox browser as an example, one can make a copy of the bookmarks by using the menu items:
Bookmarks -> Manage Bookmarks -> Import and Backup -> Export Bookmarks to HTML
which will write a file with all the bookmarks used in the browser named "bookmarks.html". It's a file of about 450K on this machine which has about a 200 bookmarks. A clone, on the other hand, will copy the whole .mozilla directory entry that runs firefox's profiles, which on this machine amounts to over half a gigabyte:
Code:
[~]$ cd .mozilla
[~/.mozilla]$ du -sh
587M
That sort of finding exhibits the notion of a "sledgehanmmer cracking a nut" almost perfectly. Most browsers I'm familiar with include a facility to copy the bookmarks to a file.

Further, since a new installation of firefox would populate its profile with all the relevant files that make up the total disk usage in a new distro installation, it's hard to see the point in storing the old installed files in a backup in any form. With a new installation, one can import the relatively small bookmarks.html file, and have lost nothing of importance. About other configurations which one might wish to keep from a browser, see the comments below.

In the case of using the clone as the backup, one has to restore the whole clone to then be able to access any single file. That is its central archilles heel from a back up point of view.

Looking at the second example of backing up hidden files, which I take to be the dotfiles in the /home/$USER directory, there are different issues, but again, backing up the lot has the same issues as those mentioned with firefox above. To make a couple of points about these files, some are configuration that a user can write, and others are configuration files that the applications themselves create either automatically using default values, or have alterations to those defaults made by the user of the apps. The only elements that need to be backed up are the settings that the user has made to alter the defaults, because when a new installation of those apps is made, the app will set all its default configuration again which relieves the user from having to set defaults that will enable the app to function as intended.

Backing up the alterations a user has made in configurations of an app can be a complex matter with a lot of details. There are different ways to manage it for the purposes of backup. In my case, I keep a text file with notes on the alterations made, and back up that relatively small text file. That file, or sometimes multiple files, also includes the alterations to configurations I've made to the configuration files in the /etc directory.

All in all, I believe effective and efficient backing up involves backing up files that one doesn't wish to lose rather than cloning a system or partition. One is best to use the appropriate tools for the job of backing up rather than adapt ones that don't fit as well despite what they appear to do.There's quite some thought that can go into how one might effectively backup. A common and straightforward way is to use the rsync tool in a script that can backup all the relevant files. There are numerous scripts online to help users, and also a number of backing up apps that themselves use rsync for the job. As with most aspects of linux, there's a learning curve involved. I think it's worth the effort to climb it a little to avoid inefficient ill-fitting "solutions" that may have superficial appeal.

There's a lot more that can be said about backing up, but I'll end the rave here :-) .
 
Last edited:
I agree with almost all of that. I use timeshift to back up my system, because I run Debian Sid and sometimes things break. I want to be able to easily restore the entire system quickly and easily if necessary. But my home and data aren't included in that. I use rsync in a cron job to back those up, excluding files and directories that aren't essential. My recommendations above were based on the assumption that many new users want a GUI, and are afraid of using the terminal. They can be eased into things while staying safely backed up. I prefer using the terminal to GUIs for system maintenance, but I'm just one user. Not everyone does. I rarely if ever want a byte-for-byte clone of a system, I just don't see the need.
 
Both Foxclone and Rescuezilla offer two features...to Clone or to create an Image...both are very different.

A Clone copies all the space on the Drive and puts it on a Drive of the same size.
An Image copies the used space on the drive and creates a File which is stored on an External Drive.

The Image is the best way to go...because it can be put back on the same Drive or on a new Drive or on a different computer.

I now use both Foxclone and Rescuezilla to create an Image because you should always have more than one backup tool.

The OP wanted to back up everything...Foxclone and Rescuezilla will do just that.
1763330215903.gif
 
Here ares several ways to backup the files you might need:
Code:
Debian backups

Installed Packages

A quick way of backing up a list of programs is to run this:

dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys

It will back them up in a format that dpkg can read* for after your reinstall, like this:

New way:
dpkg --get-selections > ~/Package.list
Copy file to new installation
dpkg --set-selections <  ~/Package.list
sudo apt install dselect
sudo apt dselect-upgrade

Old way:
sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dselect update
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

* You may have to update dpkg's list of available packages or it will just ignore your selections. You should do this before sudo dpkg --set-selections < ~/Package.list, like this:

apt-cache dumpavail > ~/temp_avail
sudo dpkg --merge-avail ~/temp_avail
rm ~/temp_avail


Settings and Personal Data

Before you try to upgrade, you should probably back up the settings from your programs, this can easily be done by grabbing folders from /etc and all the content from your user directory :

Back use /home using rsync

rsync --progress /home/`whoami` /path/to/user/profile/backup/here

After you install, you can restore it with:

rsync --progress /path/to/user/profile/backup/here /home/`whoami`

System Backups:

Backup System configs in /etc
sudo tar -czf etc-backup-$(date +%Y%m%d).tar.gz /etc

Backup Installed Packages
dpkg --get-selections > package-selections-$(date +%Y%m%d).txt

Backup keyrings
sudo tar -czf keyrings-backup-$(date +%Y%m%d).tar.gz  /usr/share/keyrings

Backup APT (backing up /etc already does this, I  just like to have it in a separate file)
sudo tar -czf apt-backup-$(date +%Y%m%d).tar.gz /etc/apt/

######################################################

User Backups:

Backup User configs (A separate copy of user settings)
tar -czf user-backup-$(date +%Y%m%d).tar.gz  ~/.config

Flatpaks
Create a list of installed flatpaks
flatpak list --system --app --columns=application | tail -n+1 | sort -u > flatpak.list

Backup flatpak setting
sudo tar -czf  flatpak-settings-$(date +%Y%m%d).tar.gz ~/.var

Snaps
Create a list of installed snaps
snap list  > snap.list

Backup Snap app settings
sudo tar -czf  snap-settings-$(date +%Y%m%d).tar.gz ~/snap

Complete Snap files
sudo tar -czf snap-files-$(date +%Y%m%d).tar.gz  /snap

Backup node
npm list --global --depth=0 > node.npm.list

Backup Python
pipx list --global --short
pip list --not-required > python.pip.list

Backup Ruby Gems
gem list > ruby.gem.list

DOTFILES=~/.dotfiles
mkdir -p "$DOTFILES/bak"

Export vscode extensions
code --list-extensions > "$DOTFILES/bak/vscode.bak"

Gnome Desktop plugins
gnome-extensions list --user --active > gnome.ext.usr.list
gnome-extensions list --system --active > gnome.ext.sys.list

Containers
sudo podman images --format {{.Repository}}:{{.Tag}} > podman.img.list

Or just do a full disk copy as others have mentioned.
 
AFAIK apt-key has been deprecated everywhere. It hasn't been available in Debian for some time. I once used dpkg, but I found that there are better ways for me. It is one choice, however. There are many ways to get things done in Linux.
 
good day dear friends :)

....here i am back :cool:

thank you all for sharing your ideas, thoguths and experience. this is much much more than expected and yes: i am really overwhelmed:

thank you also for your comment dear @CaffeineAddict

For fresh install the only data you want is your own data, like pictures, bookmarks, game saves etc.
Everything else will be installed from zero.
If you want to backup system configuration, the method I use is to have noted down all my configurations (steps to configure) which then upon fresh system install I simply reconfigure it manually.


fully agreed - youre 100 % right - see more below

thank you also dear @craigevil


.
Code:
Debian backups

Installed Packages

A quick way of backing up a list of programs is to run this:

dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys

It will back them up in a format that dpkg can read* for after your reinstall, like this:

New way:
dpkg --get-selections > ~/Package.list
Copy file to new installation
dpkg --set-selections <  ~/Package.list
sudo apt install dselect
sudo apt dselect-upgrade


many thanks for the sharing of your ideas, thoughts and ideas. Well - i am very glad to see this. Its so awesome to see the vital community and all the help here: I have some additional thoughts that i just want to share with you - and that are werent spelled out so clearly at the thredstart:

what is aimed: since i am currently working on the backup of a notebook: i only need ot backup a certain amount of data: not the whole systen. So this has to be mentioned here: again - well all i want to archive is to copy just everything from my home directory to an external drive


Including the following data:

  • hidden files
  • documents
  • browser bookmarks and profiles
  • application settings

to say what is needed: important first thoughts: i do not want to copy the entire filesystem (/) no not: — that said i think that this will cause severe and serious permissions problems, So to spell it out clearly: system files are not needed, and it risks copying mounted system paths.
What i need is the entire user’s home directory, because all personal data that i am interested are inside /home/<username>
that said: all hidden files ( guess that all that stuff is quite starting with the following "sign" .) are probably included there ( as i think herein are the following datasets: browser profiles, app configs, SSH keys, etc.)

hmm do i really need system-level settings, well i can back up only specific directories.
the main goal i want to achieve is just to copy all stuff and everything from my home directory to an external drive

hmm - i guess that this can be done safely and fully with one command in terminal.
that said: i think that this can be done safely and fully with one so calles "onliner command".

the question is: hmm what is the cleanest possible method to back up everything in my home directory (including all hidden files) before reinstalling.

some preliminary assumptions on the process - ideas how to start this:

To backup the Entire Home Directory (where everything i need is included) - i think i have to make sure my external drive is mounted - Afaik - usually it appears somewhere like:


Code:
/media/<myusername>/<drive-label>/


i think that we can verify with:

Code:
 bash ls /media ls /media/<myusername>/

well can i do this so:
.... any ideas!?

have a great day - greetings :):)


.....update after doing some research i found out. - there are some command that support me here - and that help out..

well regarding tar:

tar
packs all the files into a one tiny single file "archive, " which can then be compressed to save space - ant a tar file that can be very handy and easy to port over.


...... regarding the rsync:

afaik the rsync will copy exact files, and besides that it can speed up by only copying what has changed - thats pretty very smart and clever. so i thnk that the concrete commands then would look like so:

Code:
tar -cJpf /media/<the concrete username>/bkup.tar.xz /home/<username>

rsync -aHAX --progress /home/<the concrete username>/ /media/<username>//


.....Well that said - i guess that i am in a very convinient and good situation- i have now very handy commands that support the process


have a great day greetings :)
 
Last edited:
Rsync was written many years ago to do the exact thing you want, and is the gold standard for such backups, IMO. TAR stands for Tape ARchive, and was designed to back systems up to actual tape media. It works, but it's not as user-friendly, and puts the entire archive into one file. That can be useful, but it can also be undesirable, depending on the user's needs. It's a user choice as to which to use.
 
Rsync was written many years ago to do the exact thing you want
+1 to rsync as backup tool, only downside is you have to write a script about what to back up.

I'm lazy to maintain it so I simply copy/paste to external disk what I absolutely don't want to lose, everything else is either junk or can be reinstalled by new OS install.

@dhubs
You don't need to backup your whole home directory, it contains leftover junk from uninstalled software.
Not only that, it also contains cache and similar stuff that's not worth transferring to fresh system.

Important thing here is FRESH install, that means you get 100% clean and working system without any junk but you want to pollute it with junk from old system, that's no longer fresh install.

You also don't need your whole firefox profile, simply reconfigure your browser on new install and import your bookmarks.
fresh state is worth much more that doing less work.
 
I've seen no need for a script for rsync. I do a couple of backups through cron, using desired options, and I also do one-off ad hoc backups using just -av, or sometimes other options. I admit to sometimes running 'rsync --help' to refresh my memory on all the available options. On my full /home backups I do use the --exclude= option, so as to not back up ~/.cache and other unnecessary directories. It works for me, but the options are many and varied.
 
hello dear @CaffeineAddict hello dear @deb_user :)


.....first of all many thanks for the reply and for sharing your ideas and experience.


You don't need to backup your whole home directory, it contains leftover junk from uninstalled software.
Not only that, it also contains cache and similar stuff that's not worth transferring to fresh system.

....thank you - this is very helpful

Important thing here is FRESH install, that means you get 100% clean and working system without any junk but you want to pollute it with junk from old system, that's no longer fresh install.

that sounds interesting - and convincing. - i never have seen these relations - but you help me to see more - this is convincing.:)

You also don't need your whole firefox profile, simply reconfigure your browser on new install and import your bookmarks.
fresh state is worth much more that doing less work.

thank you dear deb_user:

Use rsync....hmmm - should i do this like so:

Code:
rsync -rtv source_folder/ destination_folder/

    r for recursive copying of directories
    t for preserving modification times
    v for increased verbosity


look forward to hear from you...

greetings:):cool:
 
I usually use -a for archive, but whatever options work for you is fine. I've never used -r, because that seems to be done automatically, at least for me.
 


Follow Linux.org

Members online


Top