#[SOLVED] NVME migration
130 messages · Page 1 of 1 (latest)
Create the normal partitions on the 1n1 but instead of ext4 format the rootfs as btrfs
Then create subvols according to the archinstall layout because it's good for snapshotting since it separates the pkg cache
hm.. how does btrfs work? is it a single partition setup? like, do you just format the root (hence its called "subvolumes"?)
Have all of them mounted right and them you can rsync the old install to the new
https://wiki.archlinux.org/title/Rsync#Full_system_backup
rsync -aAXHv
Yeah
i see. thanks for some useful stuff as this is my first time touching btrfs
hm7 received a thank you cookie!
With the mount command you use -o subvol=subvolname
Name could be for example @ or @home
If you mount a btrfs without specifying the subvol you mount the top-level subvol which depending on your layout isn't what you want (when using @ subvol as the rootfs)
i see. think its easier to just manually regenerate /etc/fstab, or should i just use the genfstab in the archiso once done to automatically deal with the fstab?
You can mount the subvols and then generate the fstab, it's not hard to mount them right
i mean, i wouldnt assume it is once ive read more about subvols via the arch wiki
"btrfs": [
{
"mountpoint": "/",
"name": "@",
},
{
"mountpoint": "/home",
"name": "@home",
},
{
"mountpoint": "/var/log",
"name": "@log",
},
{
"mountpoint": "/var/cache/pacman/pkg",
"name": "@pkg",
}
],
The format is like that because it's from the archinstall config, btrfs itself doesn't use any config like that
i assume this still requires a dedicated boot partition, right?
or should it also be a btrfs subvol?
according to the wiki, one uses btrfs subvolume create /path/to/subvolume to make a subvolume. where does the "name" part of the json you posted come in? and is path/to/subvolume essentially the "mountpoint"?
Grub can boot btrfs
Mount the top-level subvol and then create the subvols in it
Then unmount and mount the rootfs subvol and create the dirs for the other mountpoints
could you guide me, as this felt a bit confusing? what ive done so far:
used cfdisk to make a partition on the disk.
ran mkfs.btrfs -f -n 32k -L root /dev/nvme1n1p1
ive also mounted that partition to /mnt.
what i didnt quite get is the fact that i first mount it, make subvolumes and then unmount it before mounting the rootfs. does that mean i should make a subvol for root using btrfs subvolume create /mnt (as thats where its mounted)?
Create /mnt/@, /mnt/@home and so on
how would i make the @log one seeing it is nested inside /var?
The -n isn't needed btw
/mnt/@log
It's not the same as the mountpoint
This layout is called the flat layout btw
i see. Arch wiki mentioned the flag and said a higher one may yield less fragmentation with the downside on slight memory increase on operations
seems fine?
if youre wondering where ID 259 is, i made the log, thought it was incorrect, deleted it, asked you and then recreated it again
Good
is this where i unmount it and mount the rootfs?
Don't create a separate @boot because it makes it more complicated to use snapshotting because you won't be able to just rollback the rootfs and have the kernel rolled back too
Yeah
and then use mount -o subvol=/@ /dev/nvme1n1p1 /mnt, and repeat that for each subvolume similar to mounting normal partitions? just that i change subvol and mount location (as opposed to the device and mount location)?
oh. wiki says mount -o subvol=/subvol_root device /mnt/ (though they used subvol_root as label)
thats why i assumed the trailing slash
it seems to have accepted it
maybe..?
shows up the same in lsblk both with and without
i went without the leading / for safety
is it just rsync + fixing /etc/fstab and fixing grub left?
huh? what do you mean by an ESP? just.. /boot as the relative location or..?
Efi system partition
The fat32 partition where the efi file is installed by grub-install or similar
Grub can read btrfs but the uefi can't directly
Nor can uefi read ext4 or fs other than fat
Usually it's mounted at /boot/efi or /efi
well that info likely makes it so i have to redo this so far. now, in a hypothetical scenario, say that nvme1n1p1 was the efi partition formatted as fat32, while nvme1n1p2 was the btrfs one with all subvols. would i just mount it into /boot of the dystem as normal?
Some mount it at /boot but that's usually only required when using systemd-boot
wait really? not /boot?
Some mount it there for various reasons
I think for btrfs snapshot use it would be better to keep that on the rootfs so it's rolled back when a snapshot of the rootfs is booted
kind of makes sense. so i should have an efi partition mounted to either /boot/efi or /efi as opposed to /boot for rollback reasons. just need to debate which. is there a difference otherwise to setting up the rest of the system?
No diff
thanks! ill redo most of the steps with an EFI partition this time around, run Rsync and fix fstab. though rsync will likely shove the old grub files into into /boot. i assume ill just remove whatever files grub generates in /boot/efi from /boot then
hm7 received a thank you cookie!
i very much appreciate the help
The grub files will still go to /boot, only the efi location changes
right. but when using grub-mkconfig i should aim at /boot/EFI?
Don't wipe the other disk right away before booting and confirming everything you want transferred gas transferred
understandable as its a functioning system still
In grub-install you only change the --efi-directory, nothing else changes
The --boot-directory has the default of /boot which remains unchanged
ah. my bad. wrong command. i did mean the one with the --efi-directory
also. i remade partitions + btrfs subvolumes. i noticed that Arch wiki mentioned that the rsync command uses that current root, so i then unmounted the subvols, mounted the original system and then chrootrd before mounting the subvolumes in the chroot instead. ill just have to remember to exclude it from the clone
You can just change the command to specify the source
well, i was silly and didnt know. this is close to the equivilant. besides. i had to remember to install btrfs-progs, so i did that as well while i was at it
welp. time to prepare the long rsync command
rsync -aAXHv --exclude='/lost+found/' /oldroot /mnt
Actually I dunno if exclude is relative to the source
no clue. id say chroot is easier
arch wiki also says to exlcude a bunch of /proc + /dev and other things, so im mostly using that. makes sense as devices and such are discovered dynamically rather than being static
It's a pattern so '*/lost+found' would match it
Yeah that needs to be done when in the system
i didnt ignore /mnt but thats because i didnt mount the new filesystem there. i have a symlink there i wish to retain without having to remake it. i did remember to exclude the new root though
right.. so i used grub-install. so i now have an EFI folder inside my /boot/EFI. do i just delete the old GRUB and BOOT folder inside /boot/EFI from previous grub?
note that i chrooted into the new system
wait. was i stupid and misunderstood? should i have mounted the efi partition as /boot during the clone?
hmmm..
No
so ive done it right?
Yeah
what about this? ^
You can delete any grub files and they'll be created in the right places by grub-install and grub-mkconfig cmd from the wiki
Really you could remove all files from /boot and recover with -S linux X-ucode and the grub commands
i just removed the GRUB dir + anything in /boot/EFI and reran the grub commands. i think thats it. also remade the /etc/fstab with genfstab. anything else, or do you think im ready to reboot? because i certainly feel ready
Yup
hmmm.. something is up with my boot entries
color is wrong, but thats fine as i previously used a theme. likely destroyed some theme files from grub which ill deal with later. but i have duplicate entries
that is however unexpected
interesting..
Os prober added the previous install
first entry (despite UEFI saying it points to the 2TB SSD) booted my previous install (the old partitions were mounted as / and /boot also get this weird error:
get the same error on the second entry, but also get this (unlike the 1st one where it boots)
thats weird.. i removed os-prober and commented the line again in the install before rerunning grub-mkconfig
/boot as btrfs doesn't allow savedefault in grub
You need to edit the grub config to disable that feature
/etc/default/grub?
uhh.. im not sure if GRUB_CMDLINE_LINUX="rootfstype=ext4" is doing me much of a favour either
That isn't even needed on ext4 lol
ill just comment it
second entry now works. but the old one still exists after a reboot. thoughts on that or..?
seems grub-customizer wishes to remove the entry. so.. i guess thats that
well done on stupidity Jorgen
it removed the wrong Arch entry
1 moment while i once again fix GRUB
screw it. i think ill just do what you mentioned and delete the entirety of /boot and reinstall linux amd-ucode and fix grub after
nice joke there. see the grub config? exactly why did it decide to keep the fallback of the new install but use the original install for the normal entry
right. so removed everything in /boot, reinstalled linux amd-ucode and remade the grub config. het it still only shows the old entry. im guessing this is thanks to grub-customizer
its likely /etc/grub.d thoughts on what to do?
fixed it. removed /etc/grub.d, reinstalled grub via pacman and remade the config
thanks @wet breach . everything seems resolved now. ill run this new install for a bit until i feel confident everything works. after that i may then repurpose the old NVME. i owe you big time
hm7 received a thank you cookie!
[SOLVED] NVME migration