On 1/21/22 11:36 PM, lou wrote:
i've installed bullseye on usb disk
can i copy it to hard disk (sda2) and make necessary change in
/etc/fstab and
then update grub of usb disk to boot sda2?
Thanks!
I have a SOHO network with about a dozen IoT, iOS, Android, Windows,
macOS, Debian GNU/ Linux, and FreeBSD machines.
Copying/ imaging/ cloning Debian (and FreeBSD) operating system
instances from one device to another is possible. There are multiple
choices.
A simple case is to image the entire device. Boot the Debian Installer
(d-i) (or a live Linux distribution) and use dd(1) to copy the entire
USB drive to the entire HDD:
# dd bs=1M if=/dev/disk/by-id/usb-... of=/dev/disk/by-id/ata-...
When done, shut down the computer, disconnect the USB drive, boot the
computer, enter the CMOS setup utility, adjust the settings, save the
settings, exit Setup, and boot the HDD.
Of course, the number of sectors on the target device must be equal to
or larger than the number of allocated sectors on the source device.
And, if the device uses GPT partitioning, you must deal with the backup
partition table at the end.
Also note that if the USB disk was partitioned with the MBR scheme, the
d-i may have written an entry to /etc/crypttab or /etc/fstab for swap
that uses a /dev/sd?? partition node. (Boot and/or root should be based
upon UUID). Using /dev/sd* nodes is brittle and can break if you add,
remove, or rearrange drives. My fix is to replace the swap partition
/dev/sd?? value with a /dev/disk/by-partuuid/... value.
While doing the work by hand from a d-i rescue console or a live Linux
distribution terminal is possible, it is error prone. I have written
scripts to automate most of the steps. Alternatively, there are
purpose-built tools for cloning drives. Clonezilla is one FOSS example:
https://clonezilla.org/
David