Using the CLI to backup or copy a Linux system

@ihasama ,
Well done,
It is a hardware issue after all.
It may not be an easy job checking sata cables and pcie cards in a laptop.

2 Likes

I think the best option is to start finding a ā€œnewā€ laptop. I plan to buy a used one. Many companies here rent their laptops and after 2-3 years they are ā€œoldā€ and then they rent new ones.. I can get a decent business laptop (like Elitebook or Thinkpad) for 500-600€. They usually have i5/10th gen and 16gb RAM. You get warranty for the laptop also.

4 Likes

Good choice… assuming you must have a laptop.
I prefer desktops, but I do not need to be mobile.
My i5 desktop was a refurbished one.

2 Likes

Yes. I use it for my work at home and at work. I am tempted to buy a MAC with M1 and put Linux to it but they are still pricey. It is small, no fan and the battery lasts for the whole day.

1 Like

Could be a problem with compatability, the m1 was not around that long, not tried one myself with linux so just a question.

Hi Paul, I have Pinebook Pro which has arm64 architecture processor like the M1. The bootloader part is different, you need a pre-bootloader before grub (like m1n1,tow-boot,u-boot) and of course the OS needs to be ARM64, not x86_64. But I’ve installed Gentoo to the Pinebook Pro and all needed apps works. There’s special kernel for M1 chip (Asahi) and great instructions how to install on Gentoo wiki. But this is off topic here!

Thanks for the extra info, thought it was unique to the mac

There’s also Snapdragon laptops with ARM64.

2 Likes

My next attempt at an rsync recovery

  1. Reinstall Peppermint
    set intel_iomme=off in /etc/default/grub
    apt update-upgrade
    install firefox-esr, rsync

  2. mkdir /mnt/backup
    mount /dev/sdd3 /mnt/backup
    rsync -avxHAXS
    –exclude={/dev/,/proc/,/sys/,/run/,/mnt/,/media/, /tmp/*}
    / /mnt/backup

  3. check

sent 5,597,058,547 bytes  received 8,623,031 bytes  53,134,422.54 bytes/sec
total size is 5,988,749,451  speedup is 1.07
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
# ls /mnt/backup
bin   dev  home        lib    lost+found  mnt  proc  run   srv	tmp  var
boot  etc  initrd.img  lib64  media	  opt  root  sbin  sys	usr  vmlinuz

It looks OK.

  1. Try a recovery to an non-running Peppermint

One file called fosstry2 has been edited since the backup.
I booted MX and did the following within MX

Identify /dev/sdi3 as the backup made in 2. above
Identify /dev/sdh7 as the Peppermint partiton to be recovered to.
mount /dev/sdi3 /mnt/source
mount /dsv/sdh7 /mnt/dest

rsync -avxHAXS --exclude={/dev/*,/proc/*,/sys/*,/run/*,/mnt/*,/media/*,/tmp/*,/etc/mtab} /mnt/source/ /mnt/dest

That recovers on top of the existing Peppermint … I did not erase it.

I then booted Peppermint… it booted OK, and I was able to check files.
It set dates of all files in my /home/nevj dir to 2 days ago,
and it changed the modified file to its version 2 days ago, but it also changed its
ownership to root… I must hav originally made the file as root..
It also recovered a number of .mozilla files, and some thing in /usr/lib/rc/cache.
It looks to me like the recovery was successful, except for the file ownership issue.

So I mount the backup copy and check… surprise !!! the file fosstry2 is not there.
So rsync must have deleted it ???
We do not have it quite right yet… wipe it all and start again… --delete is a tricky option

When will I learn to mount the backup read only

Update:
The man page says

--delete
    This tells rsync to delete extraneous files from the receiving side (ones that
 aren't on the sending side), but only for the directories that are being 
synchronized. You must have asked rsync to send the whole directory (e.g. 
lqdirrq or lqdir/rq) without using a wildcard for the directory's contents (e.g. 
lqdir/*rq) since the wildcard is expanded by the shell and rsync thus gets a 
request to transfer individual files, not the files' parent directory. Files that are
 excluded from the transfer are also excluded from being deleted unless you 
use the --delete-excluded option or mark the rules as only matching on the
 sending side (see the include/exclude modifiers in the FILTER RULES section).
 
Prior to rsync 2.6.7, this option would have no effect unless --recursive
    was enabled. Beginning with 2.6.7, deletions will also occur when --dirs (-d) is enabled, but only for directories whose contents are being copied. 
This option can be dangerous if used incorrectly! It is a very good idea to
    first try a run using the --dry-run option (-n) to see what files are going to be deleted. 

I dont see anything about deleting files on the <source> ???

It seems to have done the recovery properly, but destroyed the backup in the process. ??

I am confused… I have to do it all again carefully and double check.

4 Likes

I think maybe your laptop may be like my J1900 Acer Mini, anything over kernel 6.12.54 will not boot!!! I have locked it down, and only use ā€œ emerge -a -uD @system ā€œ to keep my core apps updated!!!

I use this machine and Gentoo equery to get package deps for LFS!!! I could very much so live without it, but it is still running just fine!!!

2 Likes

I use 6.12.63 (binary) at the moment:

ā”Œā”€[pete@gentoo]─[~]
└──╼ uname -a
Linux gentoo 6.12.63-gentoo-dist #1 SMP PREEMPT_DYNAMIC Thu Dec 18 19:15:56 -00 2025 x86_64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz GenuineIntel GNU/Linux

I know you already are aware of the masking but in case someone else meet this kind of problem with Gentoo here’s a wiki page how to prevent portage to update a package you don’t want it to update:

2 Likes

I have use package.mask and have locked down all avenues for kernel updates!!!

3 Likes

My Gentoo does not compile a kernel unless I tell it to… Are you guys using binaries?

2 Likes

Yes, I use the gentoo-kernel-bin

2 Likes

Are you guys using binaries? Yes, but masking keeps from pulling in the kernel updates, and you just get a notification from portage, but this does not keep me from using ā€œ emerge -a -uD ā€œ to keep Gentoo updated!! If Gentoo offered a LTS kernel, I might consider it!!!

1 Like

What happens if you simply copy an initrd and a vmlinuz and /lib/modules into a Gentoo filesystem.?
I think that is all that is involved in installing a kernel?
Portage might react, but you can put it in a straightjacket.

1 Like

I have no idea, but I have my doubts it would boot!!!

1 Like

I have two M1 MacBook Pros - one is work’s…

I can’t see any reason whatsoever to favour Linux over MacOS - MacOS is UNIX and it comes with a shell (ZSH by default - the one I use nearly everywhere)…

My personal M1 was reasonably priced - probably cheaper than a Dell XPS - bought it in 2021… I kinda wish I’d got an M1 ā€œAirā€ instead now - was $300 (AUD) cheaper…

All the Linux stuff (UNIX-ish) that I use - in a shell, is available on MacOS via brew / homebrew (e.g. ffmpeg) :

╭─x@methone.local ~
ā•°ā”€āž¤  uname -a
Darwin methone.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:34 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8103 arm64
╭─x@methone.local ~
ā•°ā”€āž¤  history |grep brew|grep install|grep ffmpeg|grep -v grep
 3256  brew install ffmpeg
 3567  brew install ffmpeg
 4537  brew install ffmpeg streamlink

It’s pretty much FreeBSD and it’s mostly POSIX compliant.

Even 5 years later - Linux on Apple Silicon is not yet 100% ready… I think Linus Torvalds was running one - with Asahi - he was using an M1 to build the kernel… But I think his daily driver is still an AMD Threadripper desktop machine (see Linus Tech Tips where he works with Linus Torvalds to build a Threadripper desktop).

As per above - I don’t see the point really… The only reason I could see for installing Linux on a Mac, would be if it was Intel and there were no more MacOS updates for it… Lotsa people run Linux on Intel CPU Macs… Me? I’m agnostic - happy to use bash/zsh shell on anything remotely ā€œUNIX-likeā€ - i.e. Linux or MacOS…

The M1 has been around nearly 5 years now!

I don’t know if Apple even sell M1 anymore - everything is probably M2, 3 or 4 now… Maybe a few iPad models still using the M1?

2 Likes

The only problem would be if Gentoo needed certain kernel parameters set.
You might get away with it.
Do you have a spare Gentoo lying around that you could try it on?

1 Like

Not really!!!

2 Likes