billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.48k stars 327 forks source link

Rpi-clone on Debian 12 #162

Open titou4307 opened 10 months ago

titou4307 commented 10 months ago

Hello I have a Nuc with a SSD Samsung 1To QVO with OS = Debian 12 (pure Debian 12 Not Raspi OS)

I would like to clone this SSD on other SSD external (same disk SSD Samsung 1To QVo) via USB 3.0

My but is if the SSD actually used crash so I invert the two SSD

Does it possible to install and use rpi-clone on Debian 12 (pure Debian 12 not RaspiOS.....)

Thanks at all

viniciuspaes commented 10 months ago

Hi @titou4307!

You want to do a exact clone of the internal SSD to and identical external SSD plugged via USB 3.0? Question: If the internal SSD crash, do you want to boot from external SSD, or you intent to swap the drives, and then boot from the new internal SSD?

I ask that because then you need to take a look in your BIOS boot device priority, in case of the crash.

Another think to take a look: When you run the rpi-clone with default arguments, they will update /etc/fstab and boot partition location. If you use UUID to identify your disk, then you should be fine in most cases.

Answering your question, yes it is possible. Used rpi-clone in an old notebook and it did worked.

titou4307 commented 10 months ago

Hello Thanks for your response....

You want to do a exact clone of the internal SSD to and identical external SSD plugged via USB 3.0?

Yes it I want to do....

Question: If the internal SSD crash, do you want to boot from external SSD, or you intent to swap the drives, and then boot from the new internal SSD?

In case of crash so I will stop the machine and swap the two SSD (I put the SSD connected in USB 3.0 into the Nuc...and the SSD crashed goes out the Nuc....

I ask that because then you need to take a look in your BIOS boot device priority, in case of the crash.

After swap operation I think it not needeed to change the boot priority

Yes I would like to clone the SSB boot actually and before big update make and update of this clone.. I have done the same with a Pi4 under Os on SD card and with clone on Sd Card via USB 3.0 card reader After a crash and swap it very to restart ....

Does it clear ? sorry for my poor english, I am frenchy

viniciuspaes commented 10 months ago

Understood, just a full clone. If not using the external SSD/USB no need to set device priority after the crash.

Pretty sure the same i did here with my old computer. Anyway, take a look in the fstab, if you are using UUID: sudo cat /etc/fstab

viniciuspaes commented 10 months ago

Take a look in the example 11 from de README.md:

https://github.com/billw2/rpi-clone#11-clones-from-my-debian-desktop

titou4307 commented 10 months ago

Hello

When I type this command (root) :

root@debianha:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=47a5aa08-d8bb-4860-a48a-4a66878fe4fd /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=9A73-6A73  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sda3 during installation
UUID=eef76f7a-a53b-4cf9-97cf-f45016b3d7d8 none            swap    sw              0       0
root@debianha:~#

What command does I need to type to clone all the disk (SSD in the Nuc) to the SSD external ???

sys-clone sdb -v

It seem more complicated than rpi-clone ....

titou4307 commented 9 months ago

Hello Here my last try....

root@debianha:~# sys-clone sdb
/usr/sbin/grub-install

Booted disk: sda 1,0TB                     Destination disk: sdb 1,0TB
---------------------------------------------------------------------------
Part          Size  FS  Label           Part   Size  FS    Label
1 /boot/efi   512   0M  fat32           --    1       931  5G     ntfs  --
2 root        930   1G  ext4            --
3             977   0M  swap            --
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - partition number mismatch: 3 -> 1 ==
1 /boot/efi           (5,5M used)    : MKFS  SYNC to sdb1
2 root                (26,8G used)   : MKFS  SYNC to sdb2
3                     (0,0M used)    : RESIZE  MKSWAP
---------------------------------------------------------------------------
Run setup script       : no.
Run grub               : grub-install --root-directory=/mnt/clone /dev/sdb
Verbose mode           : no.
-----------------------:
** WARNING **          : All destination disk sdb data will be overwritten!
-----------------------:

Initialize and clone to the destination disk sdb?  (yes/no): y
Optional destination ext type file system label (16 chars max): homeassist

Initializing
  Imaging past partition 1 start.
  => dd if=/dev/sda of=/dev/sdb bs=1M count=5 ...
  Resizing destination disk last partition ...
    Resize success.
  Changing destination Disk ID ...Échec d'analyse de l’UUID.

  => mkfs -t vfat -F 32  /dev/sdb1 ...
  => mkfs -t ext4 -L homeassist /dev/sdb2 ...
  => mkswap /dev/sdb3
Destination disk has same Disk ID as source, changing it.
Échec d'analyse de l’UUID.
  Failed to set a new Disk ID.

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/sdb2 on /mnt/clone
  => rsync // /mnt/clone with-root-excludes ...

I don't know what not work .....