#[SOLVED] Cloning the SSD to an nvme

240 messages · Page 1 of 1 (latest)

tired spire
#

I cloned my Arch Linux system from a 223GB SATA SSD to a 1TB NVMe using "dd" (full disk clone, including partitions).

After cloning, I resized the partition on the NVMe to use the full disk space. The partition resize worked fine, but the filesystem didn’t expand.

My root filesystem is btrfs.

When I boot from the NVMe, the system works, but the root filesystem is mounted as read-only, and I get errors like:

  • "parent transid verify failed"
  • filesystem forced into read-only mode
  • cannot resize: read-only filesystem

"dmesg" shows multiple btrfs errors related to transid verify failures.

Important detail:
Both the original SSD and the cloned NVMe are connected at the same time, and since I used "dd", they have identical filesystem UUIDs.

Current state:

  • System boots from NVMe
  • Filesystem is read-only
  • Resize via "btrfs filesystem resize max /" fails due to read-only state

What I suspect:
Btrfs gets confused because both drives have the same UUID and are present at the same time

What I want:

  • Fix the read-only issue
  • properly expand the filesystem to full 1TB
  • keep the old SSD as backup if possible

What would be the safest way to fix this without risking data loss?

My old System was the SSD, the new one should be on the 1TB nvme.

Thanks for helping!

(More infos follow once I can use discord on that damn system)

tired spire
#

Changed uuid of the SSD and now nvme doesn't boot
I did that because I think nvme-linux uses the root subvol of SSD-linux

#

please someone help me I'm kinda worried I can't use that pc this weekend and I kinda need it

lean saffron
#

do resize and change uuid

#

and setup boot etc etc

#

and then plug it back in

#

and you should be good

tired spire
#

I can't take it out

#

It's really hard to do that

lean saffron
#

okay uhh

#

you already changed uuid right?

tired spire
#

Also I don't know how to setup these partitions

tired spire
lean saffron
#

partition uuid and filesystem uuid

#

after that just setup boot to use the new UUIDs and you should be good

tired spire
#

sudo btrfstune -u /dev/sda2
I think it was that here

#

Sda is my ssd

tired spire
tired spire
#

I think yes

#

Wait let me look

#

I still got the CatchyISO

dry plover
tired spire
#

Okay I'm already booting

dry plover
#

show an lsblk -f after booting

tired spire
dry plover
#

good they're both unmounted, and original ssd is sda2 right?

tired spire
#

Yes it's 200G so it must be the original one

dry plover
#

run sudo btrfs check --readonly /dev/sda2

tired spire
dry plover
#

ok hold on

tired spire
dry plover
#

I think it just means the btrfstune from earlier was interrupted

#

one sec I'm getting the right command from man page

tired spire
#

Okay thanks

dry plover
#

sudo btrfstune -u /dev/sda2

tired spire
dry plover
# tired spire

sorry the picture is kinda unclear, did that command finish with no errors?

tired spire
#

Yes no errors

dry plover
#

good

#

now sanity check sudo btrfs check --readonly /dev/sda2

tired spire
#

Same as before...

#

If we can't copy the files from SSD to nvme I could as well also install catchyos again and copy everything it would just take a few days but as we can't get to the SSD data yet... that probably isn't an option

dry plover
#

show the error this time

tired spire
dry plover
#

weird... fsid change finished, and then, it didn't actually finish?

#

I'm researching

#

output of sudo btrfs inspect-internal dump-super -f /dev/sda2 | grep -iE 'fsid|metadata_uuid|incompat|generation' ?

tired spire
#

I'm having issues with that en keyboard layout too but loadkeys de doesn't seem to work?

dry plover
#

sudo btrfs inspect-internal dump-super -f /dev/sda2 | grep -i log_root

tired spire
dry plover
# tired spire

here's an explanation of this (from claude but it's accurate in this case): "the check error specifically says "Couldn't setup log root tree". The bad block at offset 66781184 is the tree-log root, which btrfstune deliberately doesn't rewrite because the tree-log is supposed to be transient (fsync-replay data that gets consumed and discarded on next clean mount). The SSD was uncleanly shut down at some point during this saga, so there's an unreplayed log root pointer in the superblock pointing to a block written before the fsid change. That block legitimately still has the old fsid 39f28f6e-… because btrfstune skipped it, and now check chokes when trying to validate the log root. The rest of the filesystem is actually fine"

#

we don't need to fix that though since sda2 should be able to be mounted read only at this point, and then we can rsync it to the nvme

#

sudo mkdir -p /mnt/ssd

tired spire
#

Done

dry plover
#

now do sudo mount -o ro,nologreplay,subvolid=5 /dev/sda2 /mnt/ssd

tired spire
static gustBOT
#

alpha.lynx received a thank you cookie!

tired spire
#

unknown parameter nologreplay

dry plover
#

oops, do this instead sudo mount -o ro,rescue=nologreplay,subvolid=5 /dev/sda2 /mnt/ssd

tired spire
#

Yep done

dry plover
#

now ls -al /mnt/ssd

tired spire
dry plover
#

okay, good ssd has the data

#

now show another lsblk -f just to make sure nvme is unmounted

tired spire
#

Yep it's unmounted

dry plover
#

sudo wipefs --all /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1

tired spire
#

Sorry if it's unclear but no errors
(Can't unplug my phone every half second)

dry plover
#

now create fresh partitions on the nvme, sudo cfdisk /dev/nvme0n1

tired spire
#

Label type?

dry plover
#

select new GPT layout, and create partition 1 with 512 MB, change it's label to EFI System

#

and partition 2 the rest of the space

tired spire
#

Write?

dry plover
#

yes

#

write then quit

tired spire
#

Done

dry plover
#

just to verify do lsblk -f

tired spire
dry plover
#

make the fat32 fs sudo mkfs.fat -F 32 /dev/nvme0n1p1

#

and btrfs sudo mkfs.btrfs /dev/nvme0n1p2

tired spire
#

Done with no errors

dry plover
#

sudo mkdir -p /mnt/nvme

#

sudo mount -o subvolid=5 /dev/nvme0n1p2 /mnt/nvme

tired spire
tired spire
dry plover
# tired spire Both done

create the subvols, for sv in @ @home @root @srv @cache @tmp @log; do sudo btrfs subvolume create /mnt/nvme/$sv; done

tired spire
#

How do I load my keyboard layout

#

de layout

#

Because I can't find ; in en layout

dry plover
tired spire
#

Done

dry plover
#

did that work?

tired spire
#

Yes

#

It created the subvolumes

dry plover
#

ls -al /mnt/nvme ?

tired spire
dry plover
#

now unmount so we can mount the subvols sudo umount /mnt/nvme

tired spire
#

Done

dry plover
#

sudo mount -o subvol=@,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme

#

sudo mkdir -p /mnt/nvme/{home,root,srv,var/cache,var/tmp,var/log,boot/efi}

dry plover
tired spire
#

Done

dry plover
#

output of ls -al /mnt/nvme?

tired spire
dry plover
#

do each of these individually

sudo mount -o subvol=@home,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/home
sudo mount -o subvol=@root,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/root
sudo mount -o subvol=@srv,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/srv
sudo mount -o subvol=@cache,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/cache
sudo mount -o subvol=@tmp,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/tmp
sudo mount -o subvol=@log,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/log
sudo mount /dev/nvme0n1p1 /mnt/nvme/boot/efi
tired spire
#

Done

dry plover
#

output of findmnt /mnt/nvme -R ?

tired spire
dry plover
#

perfect

#

run each of these

sudo rsync -aHAX --info=progress2 /mnt/ssd/@/ /mnt/nvme/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@home/ /mnt/nvme/home/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@root/ /mnt/nvme/root/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@srv/ /mnt/nvme/srv/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@log/ /mnt/nvme/var/log/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@tmp/ /mnt/nvme/var/tmp/
tired spire
#

With the different spacings?

dry plover
#

no

#

show the output of those after theyre done

tired spire
#

Yeah it takes a while
Goes from 98 to 97 somehow xD

#

And then to 94

#

99

#

97

#

lol

dry plover
#

lol

tired spire
#

Crazy progress tbh

#

Does the first command do the work of the others too?

dry plover
#

no, the first command is only stuff in the root subvol like bin, usr, etc directories

#

the rest of the commands fill in the rest

tired spire
#

damn didn't know how much stuff I have

dry plover
#

@home is probably going to be the longest, but the rest will be quick

tired spire
#

This is taking eternitys
Is there a way to after the first command ran continue tomorrow? My parents probably will tell me to sleep in about half an hour

dry plover
#

yes, its possible, but I'd avoid stopping in the middle of a command

tired spire
#

@dry plover I gotta go sleep now :(

dry plover
#

can you leave the computer on?

tired spire
#

It's kinda loud

dry plover
#

is that command finishing?

tired spire
#

Doesn't seem to finish

dry plover
#

press Ctrl C once

tired spire
#

Can a live iso hibernate?

dry plover
#

I don't think so

#

did Ctrl C stop it?

#

if so then do

sudo umount -R /mnt/nvme
sudo umount /mnt/ssd
sudo sync
tired spire
#

Ssd Target is busy

#

Oh I was in it

#

Now works

dry plover
#

not yet

#

oh did the umount work?

tired spire
#

Yes

dry plover
#

yes shutdown now

tired spire
#

Done

dry plover
#

tomorrow you can resume by remounting:

sudo mkdir -p /mnt/ssd /mnt/nvme
sudo mount -o ro,rescue=nologreplay,subvolid=5 /dev/sda2 /mnt/ssd
sudo mount -o subvol=@,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme
sudo mkdir -p /mnt/nvme/{home,root,srv,var/cache,var/tmp,var/log,boot/efi}
sudo mount -o subvol=@home,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/home
sudo mount -o subvol=@root,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/root
sudo mount -o subvol=@srv,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/srv
sudo mount -o subvol=@cache,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/cache
sudo mount -o subvol=@tmp,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/tmp
sudo mount -o subvol=@log,noatime,compress=zstd /dev/nvme0n1p2 /mnt/nvme/var/log
sudo mount /dev/nvme0n1p1 /mnt/nvme/boot/efi

and then resuming the @ rsync and starting the rest of them:

sudo rsync -aHAX --info=progress2 /mnt/ssd/@/ /mnt/nvme/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@home/ /mnt/nvme/home/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@root/ /mnt/nvme/root/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@srv/ /mnt/nvme/srv/
sudo rsync -aHAX --info=progress2 /mnt/ssd/@log/ /mnt/nvme/var/log/
static gustBOT
#

alpha.lynx received a thank you cookie!

dry plover
#

you're welcome!

#

feel free to ping me if needed

tired spire
#

without this discord I probably would have quit arch months ago, thanks

dry plover
#

oh and after finishing rsyncs (not pinging you so you can ignore till tomorrow), the next steps are to fix fstab:

sudo head -n 7 /mnt/nvme/etc/fstab > /tmp/h && sudo genfstab -U /mnt/nvme | cat /tmp/h - | sudo tee /mnt/nvme/etc/fstab

(this keeps the comment and regenerates the rest)
and make sure it's correct cat /mnt/nvme/etc/fstab should have entries for /, /home, /root, /srv, /var/cache, /var/tmp, /var/log, /boot/efi, all with the new btrfs UUID and the ESP with the new vfat UUID 4E39-D1E6.

then, check for the old UUID in any other config: sudo grep -rn '39f28f6e-510c-46f3-b2f9-4d351158485c\|F215-7CFF' /mnt/nvme/etc/ 2>/dev/null

then, chroot sudo arch-chroot /mnt/nvme and reinstall grub (I think you might've had grub?) grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=cachyos --recheck and grub-mkconfig -o /boot/grub/grub.cfg

then, regen initramfs mkinitcpio -P,

at this point it'd be good to sanity check bootloader exists, uefi boot entry exists with efibootmgr, bootloader config, initramfs, kernels etc. if all is well then should be good to unmount and reboot to nvme.

tired spire
#

I'm at the first command and how is it already using that much my old SSD wasn't that big

dry plover
dry plover
tired spire
#

And rsync is only at 40%

#

It's at 400GB used I'm kinda worried

tired spire
#

Command should be correct tho

tired spire
#

@dry plover that probably is not good

dry plover
#

hold on I just woke up

tired spire
#

Oh sorry

dry plover
#

no worries lol

tired spire
#

Oh I think 700GB .snapshots is the biggest enemy

dry plover
tired spire
#

On the nvme it has more usage than the whole SSD's size

dry plover
#

which rsyncs have finished so far?

tired spire
tired spire
dry plover
#

run this sudo du -sh /mnt/ssd/@ /mnt/ssd/@home /mnt/ssd/@root /mnt/ssd/@srv /mnt/ssd/@cache /mnt/ssd/@tmp /mnt/ssd/@log

#

and then sudo du -sh --one-file-system /mnt/nvme /mnt/nvme/home /mnt/nvme/root /mnt/nvme/srv /mnt/nvme/var/cache /mnt/nvme/var/tmp /mnt/nvme/var/log

#

and sudo btrfs subvolume list /mnt/nvme

#

and show me the output of all of them

dry plover
#

yeah snapshots utilize CoW so they don't take up much extra space, but rsync'ing bloats each snapshot

tired spire
#

So just continue rsyncing?

#

Because the command stopped at 71%

dry plover
#

lets delete the snapshots so we can reclaim space

#

the rsync stopping at 71% is expected because it was resumed, 29% was already transferred

tired spire
#

??

dry plover
tired spire
#

Damn my pc is transforming into a jet engine again

dry plover
#

also this makes me wonder if ssd originally had snapshots as a subvol. can you show sudo btrfs subvolume list /mnt/ssd | grep -i snap

tired spire
#

sudo btrfs subvolume delete path

Should I use that maybe?

#

Because RM can take ages

#

Ah it finished

#

Nice

tired spire
dry plover
#

ok now the nvme should have snapshots subvol sudo btrfs subvolume create /mnt/nvme/.snapshots

#

we might need to fix snapper config later

#

next check sudo btrfs filesystem usage /mnt/nvme

tired spire
dry plover
#

proceed with the next rsync

tired spire
#

Not a single error

#

And 0 snapshots detected

#

unmount & reboot? @dry plover

dry plover
#

One sec

tired spire
static gustBOT
#

alpha.lynx received a thank you cookie!

dry plover
tired spire
dry plover
#

I think we're good to unmount everything and reboot

tired spire
#

sudo umount -r /mnt/nvme
sudo umount -r /mnt/ssd

#

???

dry plover
#

captial R -R

tired spire
#

sudo umount -R /mnt/nvme
sudo umount -R /mnt/ssd

#

??

dry plover
#

yes

tired spire
#

Like that?

dry plover
#

perfect UEFI entry is there, yes boot that

tired spire
#

It boots

dry plover
#

awesome!

#

try snapper, we messed with its setup so it might error

tired spire
static gustBOT
#

alpha.lynx received a thank you cookie!

dry plover
#

you're welcome!

tired spire
dry plover
# tired spire

check sudo btrfs subvolume show /.snapshots
and sudo snapper -c root list
and sudo snapper -c root list-configs

#

and I think snap-pac is already installed on cachyos so try pacman installing something to see if it snapshots

dry plover
#

perfect

tired spire
static gustBOT
#

alpha.lynx received a thank you cookie!