You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Question about cloning

Author (Read 4563 times)

0 Members and 1 Guest are viewing this topic.

Re: Question about cloning
« Reply #6 on: February 24, 2018, 09:59:40 PM »
 

redplanet

  • New to Forums
  • *
  • 15
    Posts
  • Reputation: 1
  • Linux Lite Member
    • View Profile
It's true that my answer was incomplete, due to time limitations I decided to deal with the easier part first, in case it was needed.
...
Hope this helps.

Yes, this is exactly the kind of information I needed!  Sorry for being so obtuse, I know lots of people need help with partitions (and now I get why I only had four...  been a long time since I had to micromanage that stuff).  I ended up just doing a clean install (SDB3), for some reason it looks like it formatted my previous LL (SDA2), thankfully nothing was really lost, but with all the customization options, 3rd party repositiories...  once I get things the way I want them, I probably want to have a backup/ability to rearrange my partitions.  It REALLY REALLY helps when people post CLI commands, especially after I (finally) figured out how to cut and paste (different key combo than what I've been using for 25 years...).  The forums here have been super helpful, and I am sure I will have lots of questions.  Thanks again!
 

Re: Question about cloning
« Reply #5 on: February 24, 2018, 07:58:05 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
The simplest solution is to use Systemback and create a bootable iso. I would look into installing this on any partition/distro you have installed. I am not familiar with Timeshift but that might be another solution.
 

Re: Question about cloning
« Reply #4 on: February 24, 2018, 06:48:13 PM »
 

Lex24

  • New to Forums
  • *
  • 9
    Posts
  • Reputation: 1
  • Linux Lite Member
    • View Profile

  • CPU: Intel Core2 6300

  • MEMORY: 2Gb

  • VIDEO CARD: Intel 82Q963/Q965
It's true that my answer was incomplete, due to time limitations I decided to deal with the easier part first, in case it was needed.

When it comes to cloning a complete distro to another partition, with all the settings and all files intact, the only foolproof method is to use a disk imaging application. Programs that work at the file-backup level, like rsync, or FSArchiver (both are available in LL repos) can never really do the job properly, sooner or later you will come across an error message about some file that just couldn't be copied for some reason. Here are the links, if you want to try going that route:

http://www.fsarchiver.org/

https://rsync.samba.org/

My favourite disk imaging application, that works 100% of the time, is Clonezilla. You can run it from a bootable CD or flash drive or you can install it on the hard drive just like any other distro. It is pure Linux, it supports a wide variety of file systems, it can be run from the terminal or a script, and it's free. The only drawback is that it doesn't offer incremental backups.

Here are the steps required to get the contents of /dev/sdb6 cloned to /dev/sdb2 with Clonezilla:

1) Create a folder or a dedicated partition for image files and backup scripts. In my case it's the dedicated partition /dev/sdb20

2) Boot to Clonezilla, start the command line and cd to that partition:

Code: [Select]
mount /dev/sdb20 /home/partimag
cd /home/partimag

3) Create partition image of /dev/sdb6. Here is the script:

Code: [Select]
#!/bin/bash

datetime=$(date +"%y%m%d-%H%M")
/usr/sbin/ocs-sr -q2 -j2 -z1 -i 2048 -fsck-src-part-y -p true saveparts lite-$datetime sdb6

4) The script will create a folder similar to this one:

Code: [Select]
lite-180224-1957
You need to modify two files inside that folder to change references from sdb6 to sdb2:

Code: [Select]
# edit this file (open it with any text editor)
parts

# rename this file
sdb6.ext4-ptcl-img.gz.aa
#
sdb2.ext4-ptcl-img.gz.aa

5) Run the "restore" script. It will restore the image of sdb6 to sdb2. To be exact, Clonezilla is tricked to think that it is restoring the image of sdb2 to sdb2.

Code: [Select]
#!/bin/bash

/usr/sbin/ocs-sr -e2 -c -t -r -k -p true restoreparts ask_user sdb2

6) Boot to another distro or live CD and change the UUID, Label and /etc/fstab of the new instance on /dev/sdb2. Currently those items are identical on both sdb6 and sdb2. They all need to be different.

Code: [Select]
tune2fs -U random /dev/sdb2

tune2fs -L mylabel /dev/sdb2

Edit UUID in /etc/fstab

7) Change UUID in Grub2 and run

Code: [Select]
sudo update-grub

I don't use Grub2 so can't provide more details.

Below are the links to Clonezilla. You would need to do some more research because I'm using an older version (clonezilla-live-20141215-utopic-amd64) and some command line parameters might be different in newer versions.

http://www.clonezilla.org/

https://drbl.org/faq/fine-print.php?path=./2_System/102_restore_image_to_different_partition.faq#102_restore_image_to_different_partition.faq

http://clonezilla.org/livehd.php


Hope this helps.
« Last Edit: February 24, 2018, 06:59:19 PM by Lex24 »
 

Re: Question about cloning
« Reply #3 on: February 24, 2018, 01:22:26 PM »
 

redplanet

  • New to Forums
  • *
  • 15
    Posts
  • Reputation: 1
  • Linux Lite Member
    • View Profile
It seems like you read the first part of my post, but not the rest, and answered a question that I never asked.  I know the MBR system, I actually made the parts inside LL (settings -> Disks) so was not 100% sure exactly what was going on, but I was not asking anything about how or why or how much to partition.  But thanks for the info, I learned something.

As I said, I had LL on 12G, and was running out of space (no swap, lots of games, and stream a lot of video).  I have extra HDDs laying around, and six operating systems is quite enough, I am just trying out some distros.  Here's me:

sda
/dev/sda1 - windows - keeping
/dev/sda2 - was LL
/dev/sda3 - win recovery part
sdb (in progress)
/dev/sdb1 - Ubuntu
/dev/sdb2 - Elementary OS
/dev/sdb3 - Linux lite
/dev/sdb4 - Tails

My question was not really about the partitions, I didn't ask about that.  Every link I found trying to find this out for myself was information about how to partition or make a boot usb/cd, but that is not what I'm doing, and not what I asked.  Space is NOT an issue, partiton creation and size are not issues that I am concerned about in regard to my question.

THE REAL QUESTION:

To reiterate, using the partitions listed above, let's say I decide I hate Ubuntu (everything except the package manager, which Elementary also has).  For whatever reason, I want to move my entire LL install from sdb3 to sdb1, keeping all installed packages and config files.  How would I do that?  Would a "backup" include all those files?  If that's not what cloning is, then what is it called?

Edited to be less condescending.  Bugs me when people answer without understanding the question.
« Last Edit: February 24, 2018, 02:02:07 PM by redplanet »
 

Re: Question about cloning
« Reply #2 on: February 24, 2018, 04:47:08 AM »
 

Lex24

  • New to Forums
  • *
  • 9
    Posts
  • Reputation: 1
  • Linux Lite Member
    • View Profile

  • CPU: Intel Core2 6300

  • MEMORY: 2Gb

  • VIDEO CARD: Intel 82Q963/Q965
Quote
redplanet: Found there was a max of 4 partitions...

If you are talking about MBR partition structure then the statement above is incorrect. Four is the maximum number of primary partitions. You can have:

4 primary
3 primary + 1 extended
2 primary + 1 extended
1 primary + 1 extended
1 extended only (ok for a second, non-bootable disk)

The extended partition can contain many logical partitions, the exact limit depends on your hardware, it can be a hundred or more.

You don't need 75 GB for LL. This is not Windows 7 or 10, Linux won't keep growing in size out-of-control. My LL v2.8 keeps steady at around 4.5 GB and never grows above 5 GB. LL v3.nn might be a bit larger but not by much. Here are the update commands that should keep the size fixed:

Code: [Select]
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get autoclean

You can easily have Windows 7 and ten different Linux distros installed on 250 GB drive. Here is an example:

# one primary partition
/dev/sda1 - 60 GB - Windows 7
# twelve logical partitions (contained in the extended partition)
/dev/sda5 - 15 GB - LL
/dev/sda6 - 15 GB - Xubuntu
/dev/sda7 - 15 GB - Arch
...
/dev/sda14 - 15 GB - some other distro
/dev/sda15 - 20 GB - data files
/dev/sda16 - 15 GB - temp files (ISO files, etc)
/dev/sda17 -   5 GB - Linux swap partition
-----
Total: 250 GB

Just google "MBR primary extended partition" to learn  more.
 

Question about cloning
« Reply #1 on: February 24, 2018, 03:08:22 AM »
 

redplanet

  • New to Forums
  • *
  • 15
    Posts
  • Reputation: 1
  • Linux Lite Member
    • View Profile
OK, installed LL, ABSOLUTELY LOVE IT.  I loved it so much I dug up a 2nd HDD, and put four seperate partitions on it to try different distros.  Tried Ubuntu.  ABSOLUTELY HATED IT.  Installing Elementary for my GF, Arch for me (overwriting ubuntu), and Tails just because.  So here is my issue.  Not a big issue, but I honestly thought it would be easier.  Maybe I misunderstood "cloning".  Also, I am somewhat of a noob, but I can install packages and add repositories.  Also, my desktop will not boot to USB, sadly.

So, I originally did a dual boot, "shrinking" my windows vista to free up a 12G partition, installed LL on it.  Turns out it was a little too small after installing several packages and games.  So, got SDB, parted it up.  Found there was a max of 4 partitions...  ok, so I decided on my distros.  Was going to have a swap drive, did some research, decided not to.  250G divided into 3 x 75G and one about 35G.  After some thought decided to put Tails on the small part.  So I am ready to install LL, but I have already installed several packages, it seems like I would want to "clone" my install, basically "move" (copy) it, settings, documents and the whole shebang, to another partition.  I do not want to "back up" anything (important data is stored in external storage or online).  Unless I am misunderstanding the terminology - is a "backup" a completely functional bootable copy?

Because, the thing is, I may want to try another distro in the near future, and put LL on my "small" partition, installing a more resource-intensive distro on my bigger one.  I want to be able to "copy" my whole installation to another partition.  There has to be something quicker than re-running the installation (from CD is kinda slow).  Help!

TL:DR I want to "copy" my entire distro including installed packages and any saved files to another partition, AND have it added to GRUB.  Easier is better, but would prefer to use packages included in LL.  Think I am using 3.6
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section