Skip to content

u/Rogurzz

In this archive from Jan 2016 to Dec 2023

33
posts
373
comments
1
media
2.3k
score
13 saved before deletion

I'd highly recommend using btrfs with snapper instead of Timeshift.

Timeshift only works on a specific btrfs subvolume layout - That is, @ and @home. So it's rather inflexible and doesn't work well beyond basic setups.

Snapper supports any subvolume layout which is designed to work with btrfs, and is therefore more suitable for most system configurations.

1 points

To keep home separate from root, you'd need to create a partition for it and format that using LUKS. Then you should be able to automatically unlock the home partition on boot via /etc/crypttab.

See: https://wiki.archlinux.org/title/Dm-crypt/Encrypting_a_non-root_file_system

Put your ESP on /efi or /boot/efi - This will separate your EFI files from the kernel images, and makes system rollbacks easier using BTRFS.

Specify [LUKS1](https://wiki.archlinux.org/title/dm-crypt/Encrypting_an_entire_system#Encrypted_boot_partition_(GRUB) when creating a LUKS container, as LUKS2 has limited support for an encrypted /boot.

2 points

I'd keep it simple and suggest using a single partition for both root and home, with their own respective BTRFS subvolumes. You can also enable snapshots for /home as a form of backup.

Since BTRFS has logical volume management capabilities - LVM won't really provide much benefit in that regard.

For configuring swap to use hibernation a swap file should suffice, and will be automatically decrypted inside the root partition.

However, if you don't feel that you will take advantage of BTRFS features, then LVM + EXT4 is probably the ideal solution.

3 points

For cloning the installation - you can create a new LUKS container and filesystem on the other SSD and then use btrfs send/receive commands to send over the files.

First mount the top-level subvolume of the primary SSD and create read-only snapshots of your subvolumes:

mount -o subvolid=5 /dev/sdX /mnt
btrfs subvolume snapshot -r /mnt/@ /mnt/@-ro
btrfs subvolume snapshot -r /mnt/@home-ro
btrfs subvolume snapshot -r /mnt/@snapshots-ro

and so on...

Unmount /mnt.

Setup a new LUKS container on the target SSD:

cryptsetup luksFormat /dev/sdX
cryptsetup open /dev/sdX root

Create the btrfs filesystem and mount it:

mkfs.btrfs /dev/mapper/root

Then with both filesystems mounted on each SSD, btrfs send/receive the subvolumes to the target location:

mount /dev/mapper/root /mnt
mount /dev/sdX --mkdir /mnt/btrfs

Send the read-only subvolumes over:

btrfs send /mnt/btrfs/@-ro | btrfs receive /mnt
btrfs send /mnt/btrfs/@home-ro | btrfs receive /mnt
btrfs send /mnt/btrfs/@snapshots-ro | btrfs receive /mnt

repeat for the other needed subvolumes.

Create writable snapshots of the read-only subvolumes:

btrfs subvolume snapshot /mnt/@-ro /mnt/@
btrfs subvolume snapshot /mnt/@home-ro /mnt/@home
btrfs subvolume snapshot /mnt/@snapshots-ro /mnt/@home

Delete the read-only snapshots:

btrfs subvolume delete /mnt/@-ro
btrfs subvolume delete /mnt/@home-ro
btrfs subvolume delete /mnt/@snapshots-ro

do the same for the primary SSD by mounting the top-level subvolume (ID=5) as pointed out in the first section.

Unmount both filesystems:

umount /mnt/btrfs
umount /mnt

Delete the empty directory:

rmdir /mnt/btrfs

Mount the root of the LUKS partition:

mount -o subvol=@ /dev/mapper/root /mnt

Edit /etc/fstab on the new installation and update the UUIDs to match the btrfs filesystem.

mount -o subvolid=@

At this point, reinstall your boot loader if required, regenerate initramfs, and reboot:

grub-mkconfig -o /boot/grub/grub.cfg
mkinitcpio -P
exit
umount -a
reboot

Your system should now boot normally as it were before the old SSD.

If you have problems with snapper not creating snapshots anymore, delete the config by editing /etc/conf.d/snapper and removing root from the quotations on the following line:

SNAPPER_CONFIGS=""

Then recreate a snapper configuration file:

snapper -c root create-config /

If you don't use the default snapper setup, follow:

https://wiki.archlinux.org/title/snapper#Configuration_of_snapper_and_mount_point

Good luck!

1 points

Install the plymouth package:

pacman -S plymouth

Add plymouth to the HOOKS array in /etc/mkinitcpio.conf:

HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck plymouth

Regenerate the initramfs:

mkinitcpio -P

Edit your bootloader configuration file and append quiet splash to show the boot splash screen i.e (GRUB):

sudo vim /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet splash"

Regenerate the GRUB configuration file:

grub-mkconfig -o /boot/grub/grub.cfg

Edit /etc/plymouth/plymouthd.conf, uncomment both options and select a theme i.e (BGRT):

[Daemon]
Theme=bgrt

Reboot.

Always consult the Arch Wiki where possible:

Plymouth - Arch Wiki

5 points

If you want to dynamically allocate swap space, you're probably better off using a swap file or swap on ZRAM.

As for the root and home partitions, either utilizing LVM or hosting both data on a single root partition will ensure you never run out of allocated disk space. On my system the partition table is as follows:

/dev/nvme0n1p1    2048    2099199   2097152     1G EFI System
/dev/nvme0n1p2 2099200 1000214527 998115328 475.9G Linux root (x86-64)

With 8GB of dedicated swap space on ZRAM:

/dev/zram0 zstd          7.8G   4K   64B   20K      12 [SWAP]

ZRAM has the added benefit of storing memory pages in RAM, which will increase performance and not use disk space.

You can shrink the other partitions using GParted to expand the size of the desired partitions. However, this method will always carry the risk of potentially destroying data. So creating a backup of the data is strongly advised.

4 points

I'd recommend against creating a subvolume for the entire /var directory as the pacman database is located in /var/lib/pacman. This may be a problem because if you rollback the system to a previous snapshot, you may lose access to the database which could render your system unrecoverable.

Instead, consider creating subvolumes for /var/cache, /var/log etc.

A typical BTRFS subvolume layout resembles something like this:

  • @ - mapped to /
  • @home - mapped to /home
  • @cache - mapped to /var/cache
  • @log - mapped to /var/log

and so on.

3 points

To create btrfs subvolumes after installation:

Mount the top-level subvolume (5):

mount -o subvolid=5 /dev/root-partition /mnt  

Create the subvolumes:

btrfs subvolume create /mnt/@  
btrfs subvolume create /mnt/@home  

Edit /etc/fstab to reflect the changes:

# /dev/nvme0n1p5  
UUID=413eee0c-61ff-4cb7-a299-89d12b075093   /     btrfs defaults,subvol=@ 0 0
UUID=413eee0c-61ff-4cb7-a299-89d12b075093  /home  btrfs  defaults,subvol=@home 0 0

Remount the filesystems:

systemctl daemon-reload  
mount -a  

Done.

1 points

To create btrfs subvolumes after installation:

Mount the top-level subvolume (5):

mount -o subvolid=5 /dev/root-partition /mnt  

Create the subvolumes:

btrfs subvolume create /mnt/@  
btrfs subvolume create /mnt/@home  

Edit /etc/fstab to reflect the changes:

# /dev/nvme0n1p5  
UUID=413eee0c-61ff-4cb7-a299-89d12b075093   /      btrfs defaults 0 0
 UUID=413eee0c-61ff-4cb7-a299-89d12b075093  /home  btrfs  defaults 0 0

Remount the filesystems:

systemctl daemon-reload  
mount -a  

Done.

1 points

To create btrfs subvolumes after installation:

Mount the top-level subvolume (5):
mount -o subvolid=5 /dev/root-partition /mnt
Create the subvolumes:
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
Edit `/etc/fstab` to reflect the changes:
# /dev/nvme0n1p5
UUID=413eee0c-61ff-4cb7-a299-89d12b075093 /home ext3 nodev,nosuid,relatime 0 2
Remount the filesystems:
systemctl daemon-reload
mount -a

Done.

1 points

It is likely that the device block IDs for your SSD are different on the new system.

If you have the drive mounted as /dev/nvme0n1p2 in /etc/fstab, it will not follow persistent block device naming conventions. Therefore you should use UUIDs of the root device to prevent boot issues with block device IDs changing.

I'd suggest using the Arch ISO and chrooting into your installation to fix this problem.

First, download the ISO and boot it from USB.

Mount the target device:

For EXT4: mount /dev/nvme0n1p2 /mnt mount /dev/nvme0n1p1 /mnt/boot/efi For BTRFS: mount -o subvol=@ /dev/nvme0n1p2 /mnt mount /dev/nvme0n1p1 /mnt/boot/efi

Change root into the install:

arch-chroot /mnt

Get the UUID of the root filesystem:

blkid -s UUID -o value /dev/nvme0n1p2 /mnt >> /etc/fstab

Edit the resulting /etc/fstab and change the old entry with the new UUID. E.g:

UUID=0a3407de-014b-458b-b5c1-848e92a327a3 /     ext4   defaults  0      1

Save the file.

Make sure the drive mounts correctly with:

systemctl daemon-reload
mount -a

Exit chroot, unmount, and reboot:

exit
umount -a
reboot
2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.