Move OS from one drive to other drive

 ╭─ion@SMA in ~ took 18ms
 ╰─λ garuda-inxi
System:
  Kernel: 6.6.40-2-lts arch: x86_64 bits: 64 compiler: gcc v: 14.1.1
    clocksource: hpet avail: acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
    root=UUID=c6251b33-c81f-43de-b1fc-a36db6234086 rw rootflags=subvol=@
    quiet loglevel=3 ibt=off
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.43 wm: xfwm4 v: 4.18.0
    with: xfce4-panel tools: xfce4-screensaver avail: xautolock vt: 7
    dm: LightDM v: 1.32.0 Distro: Garuda base: Arch Linux
Machine:
  Type: Desktop Mobo: Gigabyte model: B450M DS3H V2 v: x.x
    serial: <superuser required> uuid: <superuser required> BIOS: American
    Megatrends LLC. v: F62 date: 01/27/2022
CPU:
  Info: model: AMD Ryzen 3 3200G with Radeon Vega Graphics bits: 64 type: MCP
    arch: Zen/Zen+ note: check gen: 1 level: v3 note: check built: 2019
    process: GF 12nm family: 0x17 (23) model-id: 0x18 (24) stepping: 1
    microcode: 0x8108109
  Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 384 KiB
    desc: d-4x32 KiB; i-4x64 KiB L2: 2 MiB desc: 4x512 KiB L3: 4 MiB
    desc: 1x4 MiB
  Speed (MHz): avg: 1927 high: 3600 min/max: 1400/3600 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1339 2: 1372
    3: 1400 4: 3600 bogomips: 28758
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: AMD Picasso/Raven 2 [Radeon Vega Series / Radeon Mobile Series]
    vendor: Gigabyte driver: amdgpu v: kernel arch: GCN-5 code: Vega
    process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16
    ports: active: HDMI-A-1 empty: DVI-D-1 bus-ID: 06:00.0 chip-ID: 1002:15d8
    class-ID: 0300 temp: 28.0 C
  Device-2: Microdia Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-2:3 chip-ID: 0c45:64ab
    class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.13 compositor: xfwm4 v: 4.18.0 driver:
    X: loaded: amdgpu unloaded: modesetting alternate: fbdev,vesa dri: radeonsi
    gpu: amdgpu display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1152x864 s-dpi: 96 s-size: 305x229mm (12.01x9.02")
    s-diag: 381mm (15.02")
  Monitor-1: HDMI-A-1 mapped: HDMI-A-0 model: Acer 0x0019 serial: <filter>
    built: 2009 res: 1152x864 hz: 75 dpi: 7 gamma: 1.2
    size: 4095x4095mm (161.22x161.22") diag: 434mm (17.1") ratio: 5:4, 4:3
    modes: max: 720x480 min: 720x400
  API: Vulkan v: 1.3.279 layers: 5 device: 0 type: integrated-gpu name: AMD
    Radeon Vega 8 Graphics (RADV RAVEN) driver: mesa radv v: 24.1.4-arch1.2
    device-ID: 1002:15d8 surfaces: xcb,xlib device: 1 type: cpu name: llvmpipe
    (LLVM 18.1.8 256 bits) driver: mesa llvmpipe v: 24.1.4-arch1.2 (LLVM
    18.1.8) device-ID: 10005:0000 surfaces: xcb,xlib
  API: OpenGL Message: Unable to show GL data. glxinfo is missing.
Audio:
  Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 06:00.1
    chip-ID: 1002:15de class-ID: 0403
  Device-2: AMD Family 17h/19h HD Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 06:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.6.40-2-lts status: kernel-api tools: N/A
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.2.1 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: Gigabyte driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: f000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0 state: up speed: 100 Mbps duplex: full mac: <filter>
  Info: services: NetworkManager,systemd-timesyncd
Drives:
  Local Storage: total: 1.82 TiB used: 160.59 GiB (8.6%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Seagate model: ST9500325AS
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 1.5 Gb/s
    tech: HDD rpm: 5400 serial: <filter> fw-rev: BSM1 scheme: MBR
  ID-2: /dev/sdb maj-min: 8:16 vendor: Seagate model: ST1000DM010-2EP102
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 7200 serial: <filter> fw-rev: CC46 scheme: GPT
  ID-3: /dev/sdc maj-min: 8:32 vendor: Crucial model: CT500MX500SSD1
    size: 465.76 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: 045 scheme: GPT
Partition:
  ID-1: / raw-size: 465.76 GiB size: 465.76 GiB (100.00%)
    used: 37.37 GiB (8.0%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-2: /home raw-size: 465.76 GiB size: 465.76 GiB (100.00%)
    used: 37.37 GiB (8.0%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-3: /var/log raw-size: 465.76 GiB size: 465.76 GiB (100.00%)
    used: 37.37 GiB (8.0%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
  ID-4: /var/tmp raw-size: 465.76 GiB size: 465.76 GiB (100.00%)
    used: 37.37 GiB (8.0%) fs: btrfs dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 5.71 GiB used: 0 KiB (0.0%) priority: 100
    comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 4 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 28.4 C mobo: 27.0 C gpu: amdgpu temp: 28.0 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 6 GiB available: 5.71 GiB used: 1.82 GiB (32.0%)
  Processes: 268 Power: uptime: 10m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 2.27 GiB services: upowerd,xfce4-power-manager
    Init: systemd v: 256 default: graphical tool: systemctl
  Packages: pm: pacman pkgs: 1440 libs: 429 tools: paru pm: flatpak pkgs: 0
    Compilers: gcc: 14.1.1 Shell: garuda-inxi default: Bash v: 5.2.26
    running-in: xfce4-terminal inxi: 3.3.35
Garuda (2.6.26-1):
  System install date:     2024-02-04
  Last full system update: 2024-07-24
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       <superuser required>
  Failed units:            

 ╭─ion@SMA in ~ took 7s
 ╰─λ 


I have it on an old spinning drive and want to move it to an existing available parttion on an SSD (same motherboard) without losing my user settings or installed software. I can modify /etc/fstab to reflect changed drives. What else must I do?
Thanks in advance.

1 Like

I have failed to do so with Garuda.
I use to use dd to backup the grub/bootloader and rsync to backup the rest. It use to work in the beginning but this method has stopped working anymore. I have also tried to clonezilla and that also doesn’t work with Garuda.

In both cases, copying over content to a new drives and booting into it results in a black screen or kernel panic. I forgot which one.

Start a live and with dd clone the old disk on the new one.

I really doubt that using dd to copy an entire drive to a partition will work. But if all else fails I will try it. I’m thinking more of copying most directories with…

rsync -avhP --exclude={“/dev/“,”/proc/”,“/sys/“,”/tmp/”,“/run/“,”/mnt/”,“/media/*”,“/lost+found”} FROMPARTITION TOPARTITION

and adjusting grub.


:slight_smile:

2 Likes

Sorry, I’ve never used clonezilla. I will try with dd.

No I don’t think that dd will fit a 500gb entire drive into a 200gb partition. I suppose I will have to download clonezilla. One more complication.

My Garuda drive.

localhost:/home/ion # fdisk /dev/sda

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500325AS     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8834cffe

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 976768064 976766017 465.8G 83 Linux

Command (m for help): 


My destination drive

localhost:/home/ion # fdisk /dev/sdc

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.


Command (m for help): p

Disk /dev/sdc: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: CT500MX500SSD1  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: FDC31FB2-EAC2-0E42-B244-773677C0CF5A

Device         Start       End   Sectors  Size Type
/dev/sdc1       2048   1026047   1024000  500M EFI System
/dev/sdc2    1026048  17803263  16777216    8G Linux swap
/dev/sdc3   17803264 122660863 104857600   50G Linux filesystem
/dev/sdc4  122660864 542091263 419430400  200G Linux filesystem

Command (m for help): q

localhost:/home/ion #

/dev/sdc4 is unused. That’s where I want to put Garuda…

you can shrink the system partition below 200GB and then use dd

Thank you. I’ll try that because creating a bootable Clonezilla USB failed.

No that didn’t work. My other distro grub did not recognize the partition as bootable.

Clonezilla is working fine from USB device with Ventoy. Just install Ventoy with pacman and then on the USB device and after installing copy the Clonezilla ISO to it. No terminal or dd needed, you can do it easy in your File Manager.

You can shrink the filesystem to less than 200 GB and then use btrfs replace to move the filesystem to your new device. You can actually do the whole thing while you are booted normally in the system, because Btrfs magic. :magic_wand:

Before you begin, run a balance operation from Btrfs Assistant.

Next, shrink the filesystem. I would do a touch smaller than 200 GB if you can, just to be on the safe side.

sudo btrfs filesystem resize 190G /

Use btrfs replace to replace the current disk with the new one. In this example, /dev/sdX is the old disk, and /dev/sdY is the new disk. The new device should be available and unmounted.

sudo btrfs replace start /dev/sdX /dev/sdY /

Monitor the progress with:

sudo btrfs replace status /

After it’s done, check the new disk to ensure everything is in order.

sudo btrfs filesystem show /

Resize the filesystem on the new disk to take up the whole partition.

sudo btrfs filesystem resize max /

That should take care of the Btrfs partition. The EFI partition you can move or copy over with rsync -a, or even plain old cp or mv. Or just reinstall the bootloader. The EFI partition you can do while booted into the system normally as well.

Make sure you have current, verified backups before you begin. If something goes wrong, you could lose data.

2 Likes

I got a new (to me) 4tb nvme about a month or so back to replace a 2tb drive.

I was on fedora with btrfs, but should work fine here still.

I used clonezilla.

Swapped drives in the computer.

Booted live iso and used gnome-disks to extend partition to end of drive to use all of it.

That was pretty much it. It was a lot easier than I imagined it would be.

Obviously make a backup of anything you aren’t willing to lose.

Also note -if I’m not mistaken, the arch iso comes with clonezilla already installed on it :wink:

1 Like

Sorry, Ventoy gets some bad press among some Linux users. As for Clonezilla, I have now created three different USB that refuse to boot asking for a /EFI/boot/mmx64.efi while the directory contains bootx64.efi.

As far as I know, the concerns about Ventoy containing malware and the like go back a few years and were unfounded. I have been using it for several years to boot various ISOs such as Clonezilla, GParted and other tools, as well as the occasional Live ISO of various distros. It all works perfectly for me.
But in the end you have to decide what you use for what.

1 Like

The inevitable happened. My old spinning drive started to fail as I was using it too much and finally died. So a new installation on my target partition was easy and now comes recovering some data from my backup drive.

Why in the world is anyone using ventoy for anything? You create a clonezilla USB same as you would Garuda. . .

https://clonezilla.org/downloads.php

1 Like

As I have already posted, live version 3.1.3.16 (both .iso and .zip) will not boot on my desktop. It’s not an issue any more as I re-installed Garuda.

With or without ventoy?