this post was submitted on 07 Jul 2023
15 points (100.0% liked)

Arch Linux

7725 readers
2 users here now

The beloved lightweight distro

founded 4 years ago
MODERATORS
 

Not specifically Archlinux, but I am using Archlinux on my laptop, so I thought I'll ask here.

I am planing to replace my 1 TB M.2 SSD in my laptop with a 2 TB M.2 SSD, and I am wondering how to clone the whole 1 TB SSD and restore it onto the 2 TB M.2 SSD.

I have read about people using $dd for that, but I never did that. Can anybody confirm that this is possible?

I am running two partitions, one boot and the other one is a crypt device with btrfs + subvolumes inside.

Is there anything I have to consider, before doing this?

Thank you for your time.

top 15 comments
sorted by: hot top controversial new old
[–] Drakulad3a@lemmy.sdf.org 13 points 1 year ago (1 children)

On the wiki there is a page about dd. The section 2.2 focuses on full disk cloning.

[–] PHLAK@lemmy.world 1 points 1 year ago

Can confirm this works. Just upgraded a 256 GB SSD to a 1TB one... and it was my OS disk... and it was LUKS encrypted. Everything is working fine (maybe even better).

[–] niva@discuss.tchncs.de 8 points 1 year ago* (last edited 1 year ago) (5 children)

You could also use clonezilla. The arch install media comes with it. It is handy, because you should not boot in the system you want to clone anyway. So you can boot into your arch install media and then do all the disk cloning.

Funnily I also have to do the same thing (from 1TB M.2 to 2TB M.2) on my desktop. I might do this tomorrow or on Sunday. I plan to do this as I described. Well I don't need to save a disk image on an external drive like you because I have two M.2 slots on my mother board.

Maybe write a follow up here how you did it and if everything went well?

Good luck!

Edit: Hey my first Lemmy comment! :)

[–] Cyber@feddit.uk 3 points 1 year ago

+1 Clonezilla all the way...

dd is fine if you want an exact bit-by-bit duplication of all the bits on the drive, but, that's probably overkill.

Clonezilla (or, more accurately, the tools it runs) will only copy the useful stuff, boot sectors, partitions, files, etc... faster.

[–] g7s@lemmy.ml 3 points 1 year ago

Welcome to Lemmy, glad you found your way to Archlinux :) I have ordered a USB case for my M.2.

[–] twelve12@lemmy.ml 2 points 1 year ago

Clonezilla is the way

I use Rescuezilla to clone disks for work. It’s clonezilla with a nice GUI and livecd environment. 😀

[–] ILurkAndIKnowThings@lemmy.ml 1 points 1 year ago

I just wanted to chime in to say that I used clonezilla today to move my 250G ssd to 1TB. It was easy and fast. I used ventoy (a usb iso loader) to load stable clonzilla live. I'll only mention the major options, which were disk-to-disk, expert mode, and then -k1 (to resize the partition accordingly.

[–] pkru@lemmy.ca 7 points 1 year ago (1 children)

The Arch wiki has some really good info on using dd for cloning. I've done it myself successfully with dd, but double and triple check to make sure your command is correct before continuing. Both drives would need to be connected to the same machine at the same time (new drive in a USB enclosure or in a spare PCIe slot)

https://wiki.archlinux.org/title/Dd#Disk_cloning_and_restore

It might be worthwhile to check out GUI alternatives to dd if you feel more comfortable in a GUI vs terminal:

https://wiki.archlinux.org/title/Disk_cloning

[–] g7s@lemmy.ml 2 points 1 year ago (2 children)

Thank you, would it not be possible to dump the cloned disk into a file? I don't have a second PCIe slot in my laptop... I was hoping to connect an external drive, dump the nvme, replace it, and restore it.

[–] pkru@lemmy.ca 2 points 1 year ago

I've done something like that before with ddrescue though the example on the Arch wiki ddrescue page shows how to copy an entire drive to another drive. Here's how to backup to a file instead:

sudo ddrescue -f -n /dev/sda1 /path/to/backup.hdimage /path/to/backup.mapfile

But I'd reference the docs just to double-check: https://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html

You might need to restore the image via Arch recovery mode with a bootable USB drive loaded with the Arch ISO however.

[–] xoggy@programming.dev 2 points 1 year ago

Can you clone from the nvme to the external drive then clone the external drive over to the new nvme once installed? If you have other stuff on the disk you can clone to a file but it will be a slower process:

dd if=/dev/sdX conv=sync,noerror bs=64K | gzip -c > /path/to/my-disk.image.gz
[–] ge_generation@lemmy.world 2 points 1 year ago

I recently did this on my desktop, and followed the instructions on the wiki

I used the rsync method and worked well for me.

[–] philluminati@lemmy.ml 2 points 1 year ago (1 children)

You can replace a hard disk in a Linux computer without shutting it off or affecting any running programs by using LVM (Logical volume Management). There are some guides around for it but of course, it means being able to connect both disks to the machine at once.

[–] g7s@lemmy.ml 1 points 1 year ago

Could work, but I migrated away from LVM to btrfs. With subvolumes and quota, I don't need LVM anymore.

load more comments
view more: next ›