Cloning linux drive

Whats the best way to clone the system drive in a linux Flame?
We want to put a larger drive in one of our flames, but without the hassle of a clean install at the moment.

Clonezilla

2 Likes

if you have a usb dock with 2 sata slots cloning is very easy. When it finishes you reclaim the unallocated space of the larger drive with gparted.

That’s a good option.

Not as easy if the drive is in an M.2 slot on the mainboard and you just take a snapshot, rather than swap the drive.

I used to have a bootable USB stick that had a self-contained version of windows and a disk copy utility. But it wasn’t great and not cheap.

You almost want to make a basic Linux image that boots with memory fs into a a console and you can run the dd command to copy. Anyone have a pointer to such an image?

PS: I guess that’s what Clonezilla Live is…

My favorite way of dealing with this is with Ansible Playbooks. Since I’m always tweaking installs for multiple machines, it’s a great way of automagically firing off dozens of commands to install everything from scratch, but automated.

Ansible is free, open source, and only requires ssh keys to be installed and off you go. For example, I have the following Ansible Playbooks, which I built entirely using ChatGPT…

install_step1_dku.yml


  • name: Install DKU
    hosts: all
    become: yes
    gather_facts: no
    tasks:
    • name: Install NFS utils
      ansible.builtin.yum:
      name: nfs-utils
      state: present
      become: yes

    • name: Create /Volumes/hotstorage directory
      ansible.builtin.file:
      path: /Volumes/hotstorage
      state: directory
      become: yes

    • name: Mount NFS share
      ansible.builtin.mount:
      path: /Volumes/hotstorage
      src: ‘10.10.0.122:volume1/hotstorage’
      fstype: nfs
      opts: ‘defaults’
      state: mounted
      become: yes

    • name: Copy DKU tarball
      ansible.builtin.copy:
      src: “/Volumes/hotstorage/02_assets/flame_versions/DKU_17.3.0.tar”
      dest: “/tmp/DKU_17.3.0.tar”
      remote_src: yes

    • name: Extract DKU tarball
      ansible.builtin.unarchive:
      src: “/tmp/DKU_17.3.0.tar”
      dest: “/tmp”
      remote_src: yes

    • name: Install DKU
      ansible.builtin.shell: “/tmp/DKU_17.3.0/INSTALL_DKU”
      args:
      chdir: “/tmp/DKU_17.3.0”
      register: install_dku_result

    • name: Reboot the system
      ansible.builtin.reboot:

I have another 7-10 Playbooks I run that install Chrome, check /etc/fstab, install Teradici, mount servers, install plugins like Matchbox, Boris, Neat Video, install different versions of Flame, install Machine Learning Timewarp, and even install and configure ZFS/framestores.

I’ve found this be a much better use of my time than dealing with Snapshots or updating clones or whatever. It’s not that hard, you can self teach it to yourself over a weekend with ChatGPT and YouTubes.

You can use:

  • DD command in command prompt (most powerful, but one must be careful what he is doing because you can very easy destroy what you want to clone)
  • Disk application (which is part of every Gnome install) - create Partition Image > Restore Partition Image
  • As ALan wrote Clonezilla
  • As AntonisNtelis wrote usb dock - just be careful as not everyone can read XFS file system, and you have to physically remove drive from flame
  • Randy - secret Skynet agent?

Sometimes cloning to bigger drive has it’s own issues: you have only allocated same size as original drive and can’t use free space (cloning is 1=1) and you have to fiddle it after clone. Stick to Linux - don’t use Windows or Mac cloning soft (Linux is very sensitive about permissions and those are not always correctly read and copied by Windows).

Right. When cloning a drive, I think it’s best to clone at hardware/block level, rather than filesystem level. On occasion partition level may make sense based on what the goal is. Also best to clone while the source drive is unmounted/not in use, so you get a stable state of affairs. To much nuance that may not make it over in terms of permissions, locked files, etc.

It does take longer on drives that aren’t full, and may wasteful on larger target drive, and maybe that is ok.

All depends on circumstances.

Also this is another situation were a Central S+W Project Server has major win. Workstations become ephemeral dumb compute nodes. Swap the drive, wipe the os, burn down the workstation. Doesn’t matter, your Stone is safe.

2 Likes

As Alan stated, Clonezilla (Clonezilla - Downloads) is a very good tool to not only clone your disk but create snapshot of your system drive so you are protected in case of HW issues. All of you should have a look at this great utility.

1 Like

Agreed, I use it a lot at home with my hackintosh.

1 Like