This page is a wiki. Please login or create an account to begin editing.


7 posts / 0 new
Last post
Maximum R.I.S.C.'s picture
Joined: 2017 Oct 18
Linux has a Dark Side...

So with the usual frustrations we Mac users run into as Apple leaves us and our expensive equipment behind, I've gotten very acquainted with Linux.

It's fast, free (or cheap - donation-ware), and has some seriously great apps nowadays.
BUT it often feels like it's designed by people who love building systems more than actually using them. The chief problem is how tough it is to clone, migrate or duplicate a system once you have it wear you want it. Every time someone creates an app to make this easier (like Aptik and or the partition-mounter Pysdm), the community moves forward in a way to make those aids quit working.

Recently, I stumbled upon a method of making direct Clones of an XT4 partition in about 10-minutes (for a 11GB system). It worked repeatedly 7-times in a row. All that was required after was to edit fstab to make the new Swap-Partition mount on boot, and Grub (system-boot shell) had to be reinstalled - entire process takes about 15-minutes.

Have had amazing advice in my Bash-Scripting from the Linux Mint forums over the years, with everyone being super willing to help -> RIGHT UP TO THE POINT, I posted how to do this cloning procedure! Was immediately hit by several moderators who said my post was too vague and hard to follow, and that it would certainly lead to system corruption, blah blah blah. All untrue as it almost couldn't be easier and had just worked for me 7-times. Some of my text was even removed!

You'd think I'd insulted someone's God. All I can figure is that all the stuff required to make Linux a reliable system, beyond 'tinkerville' is being dogmatically controlled by those making their living off of it. While I sympathize with the desire to keep a business in the black, suppression of valuable information (especially when it is "Open Source") is B.S. This clannish, tribalism is really humanity at its worst.

Anyone into learning how to do it, reply here and I will post the description. No "Clonezilla" or other nonesense, just normal Gparted - found in every distro.

Comments

galgot's picture
Offline
Joined: 2014 May 7

I am interested Smile Please post your how to.
I Wanted to clone entire an Raspbian system once, just could'nt figure how.
Just copied my home folder, then made a clean install with the same user and re-copied and my files in there... And lost a few things in the process:/

Maximum R.I.S.C.'s picture
Joined: 2017 Oct 18

No Problem. As far as I am aware this should work with ANY Linux distro, regardless of family because it copies blocks like DD, but much quicker and easier.

NOTE: I have had the easiest time making a bootable USB of Rescatux, because it has all the tools you will need in one svelte package.

1. If you want to clone to a bigger partition, then no worries. If to a smaller one, you will need to shrink the empty-space first.

a. Start Gparted and select the Doner Partition. Grab the green-handle and shrink it as far as it will go. Don't worry, this won't hurt your system (actually tests it first), but often won't compress it below 30GB or so regardless of how much is used).

b. Setup your Swap on the receiving drive (2X available RAM, works well - so if 4GB of RAM, then make a Swap Partition of 8192K. At the beginning of the Drive is advisable if on a spinning drive as that part accesses quickest.

c. in the remaining empty-space on the receiving drive, don't make another partition, but instead go to the doner and select it, then right-click and hit "Copy", then in the empty space on the receiving drive, click "Paste", followed by expanding the pasted partition to fill up the empty space, or however much you want it filled.

d. Hit the execute button and watch Gparted do all the hard work for you!

e. Now while still in Rescatux, use the "Restore Grub" function and select the newly-made/cloned system and go through the prompts.

You should now be able to boot from it. BUT the newly-made Swap Partition will have a different UUID than the one from your old drive. So when you are in the new system open a Terminal window and type:
sudo nano /etc/fstab

It will show all the partitions set to automount on startup. Next open Gparted in the new system (install it if it isn't already there), and find your new Swap Partition and get the UUID from it, and copy it. You can now replace the old entry in fstab and close+save it (usually Control+X, followed-by a 'Y' then enter).

You can test Swap now after restarting by opening Terminal and typing:
free -m (will show all RAM and Swap used and available).

And that's it! A PERFECT copy with massively less work than setting up a new one, or using crappy Clonezilla.

Should also work fine in other configurations that say split the home directory into its own partition or even in exotic systems with multiple boot systems. Just always remember to reinstall Grub, and fix Swap and you will be set.

P.S. If you are doing a Laptop, you will not want to do a Swap Partition, but instead an encrypted home and encrypted Swap FILE (lots of how-to's on this). Makes your machine much safer to use on the go in case it is stolen, you will not have your info get stolen.

muttztfz's picture
Offline
Joined: 2010 Dec 2

I normally don't use any partition based backup at all. I just copy the files...

1. create new partition struction on desired system or drive (it makes sense to first connect the drive to a system that already has a working Linux on it...)
2. format the newly created partitions with filesystems of your choice
3. mount the partition structure to something like /mnt/linux, i.e. /dev/sdc3 could be the root and thus gets mounted to /mnt/linux, /dev/sda5 could be /var and thus gets mounted to /mnt/linux/var etc.
4. now use rsync to clone your system from / to /mnt/linux, excluding certain directories (obviously /mnt/linux must be excluded, but other garbage can be left out as well, like /home/*/.cache and /home/*/.thumbnails
5. now make sure to change /etc/fstab to the correct partitions. I tend to use UUIDs, so those would have to be set correctly for the new partitions.
6. setup the bootloader to /boot

It may then be additionally necessary to start on the target system from a live cd such as SystemRescureCD and configure the bootloader once more, especially on EFI systems.

This has worked for me everytime, but it is several hours and not 15 minutes. On the plus side I get to think about the partitioning and get to set it up specifically for the target system.

BTW, your way isn't wrong.
Linux people are sometimes just like Apple people: they don't easily accept being told that there is another way. But, like you did, if the one forum kicks you out, there are several other forums available. Linux has many many ways to do things, and you are right to publish your way. Don't tolerate ignorance and intolerance!
Sorry to say, but I'm not a Linux Mint fan. I love Debian, Arch, openSUSE, Gentoo. Ubuntu is okay, but I prefer Debian over it.
I know there are people who choose Fedora, but I don't. Couldn't even tell you why. But, again, this is the greatness about Linux: you get to choose! (And there are at least a dozen more reliable distributions out there...)

m68k's picture
Offline
Joined: 2016 Dec 30

With Linux you always have to seperate the wannabe script kiddies from the genuine amateurs from the real life administrators. While the first two do indeed often enough mistake ignorance for a virtue, the last ones have a very serious reason for their stickiness with details:
Linux and Unix in general *always* assume you know what you are doing and there are few - if any - failsaves.
You can easily mess up a multi-million $ systen with a single command line error (dd with wrong 'of=' anyone?) and even the most basic commands can have vastly differing parameters between Linux/Unix versions.
No admin wants to be the guy who shut down the company, because he misread or followed a faulty instruction on some tech forum. And no forum admin wants to get flamed, because he let such instructions stand on his site.

Maximum R.I.S.C.'s picture
Joined: 2017 Oct 18

Sorry having been an admin for 4 multi-million/billion dollar companies, I disagree. You REALLY have to know what you are doing in Terminal to cause damage (and if you don't have backups - you're a crap admin), and anyway, the comment initially had nothing to do with admin work and everything to do with quick setup of a new system, without that nonsense of hours of configuration for each install. There's a very real freemasonry 'Guild' mentality in the Linux community of keeping the most important tools away from anyone trying to mainstream the system, because then their strangle-hold on the secrets would falter.

m68k's picture
Offline
Joined: 2016 Dec 30

Having worked for multi-billion $/€/£ companies for almost three decades myself by now, I can assure you that you can screw up your system from the terminal with one single faulty parameter.
And yes *everyone* (including yourself) is gonna call you a "crap admin" afterwards - for real admins don't make mistakes, right?!
And exactly that kind of "you-should-have-been-born-with-all-that-knowledge" mindset is the reason why I, too, want my tech forum websites to be flawless when it comes to details.
For no one - see your own remarks - will have the slightest feel of forgiveness if I rely on a badly worded piece of advice and sink the coporate file server, because somebody in that thread forgot to mention the platform specific difference in fstab syntax. So yes, if someone gives instructions I want them to be precise, peer reviewed and platform specific.
PS: Only a fool pushes "that button" thinking there will always be a backup to save the day. Large corps handle their backup landscape via dedicated - often outsourced - teams and you only know whether you got a valid backup or not the moment you ask for a restore.