You are not logged in.

#1 2024-06-07 12:27:05

brownpaperbag
Member
Registered: 2024-02-07
Posts: 11

Add new device to BTRFS and encrypt it

Hi, everyone!

So I have BTRFS and one disk and I tried to add another disk to my home directory.
Also my drive is encrypted with LUKS and password.

Here are my subvolumes:

ID 256 gen 123819 top level 5 path @
ID 257 gen 123819 top level 5 path @home
ID 258 gen 123819 top level 5 path @log
ID 259 gen 123797 top level 5 path @pkg
ID 260 gen 123756 top level 5 path @.snapshots
ID 261 gen 122494 top level 256 path var/lib/portables
ID 262 gen 122494 top level 256 path var/lib/machines
ID 263 gen 123782 top level 5 path timeshift-btrfs/snapshots/2024-06-06_12-24-56/@
ID 264 gen 123782 top level 5 path timeshift-btrfs/snapshots/2024-06-06_12-24-56/@home

Everything was fine. I successfully added new disk with encryption and checked that home folder size is bigger.
But then I decided to restart Arch and after entering password for my encrypted disk (I mean main one) I got weird error.

A password is required to access the root volume:
Enter passphrase for /dev/nvme0n1p2:
:: performing fsck on '/dev/mapper/root'
:: mounting '/dev/mapper/root' on real root
[  17.268571] BTRFS error (device dm-0): devid 2 uuid 588f5352-76db-47ed-972b-11c5d1e9a883 is missing
[  17.268660] BTRFS error (device dm-0): failed to read the system array: -2
[  17.269196] BTRFS error (device dm-0): open_ctree failed
mount: /new_root: fsconfig system call failed: No such file or directory.
ERROR: Failed to mount /dev/mapper/root on real root
You are now being dropped into an emergency shell
sh: can't access tty; job control turned off

I tried to find this UUID but had no luck.
One interesting thing is that I was unable to mount main drive unless I open another drive with luksOpen.
Now I think this is right because and I amd dumb.

Anyway I fixed error above when removed second drive from BTRFS but I still need it so can someone give me guide
how to properly add it?

/etc/fstab

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/ainstnvme0n1p2
UUID=a5976d97-f473-4c90-bad9-283de191dd0f	/         	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=256,subvol=/@	0 0

# /dev/mapper/ainstnvme0n1p2
UUID=a5976d97-f473-4c90-bad9-283de191dd0f	/home     	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=257,subvol=/@home	0 0

# /dev/sda
#UUID="a5976d97-f473-4c90-bad9-283de191dd0f"     /home           btrfs		defaults,subvol=/@home 0 0         

# /dev/mapper/ainstnvme0n1p2
UUID=a5976d97-f473-4c90-bad9-283de191dd0f	/var/log  	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=258,subvol=/@log	0 0

# /dev/mapper/ainstnvme0n1p2
UUID=a5976d97-f473-4c90-bad9-283de191dd0f	/var/cache/pacman/pkg	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=259,subvol=/@pkg	0 0

# /dev/mapper/ainstnvme0n1p2
UUID=a5976d97-f473-4c90-bad9-283de191dd0f	/.snapshots	btrfs     	rw,relatime,ssd,space_cache=v2,subvolid=260,subvol=/@.snapshots	0 0

# /dev/nvme0n1p1
UUID=4577-96DA      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

/etc/crypttab

# Configuration for encrypted block devices.
# See crypttab(5) for details.

# NOTE: Do not list your root (/) partition here, it must be set up
#       beforehand by the initramfs (/etc/mkinitcpio.conf).

# <name>       <device>                                     <password>              <options>
# home         UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37    /etc/mypassword1
# data1        /dev/sda3                                    /etc/mypassword2
# data2        /dev/sda5                                    /etc/cryptfs.key
# swap         /dev/sdx4                                    /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
# vol          /dev/sdb7                                    none
#ssd_512        UUID="523f43f5-9b0f-46c1-92d0-8f2f3130d586   none                    luks

sda and ssd_512 is a newly added disk.

Thanks in advance!

Offline

Board footer

Powered by FluxBB