Hey,
I've got two partitions, a data partition (the /home directory) and a system partition (the /root directory) and I wonder how I can completely reinstall the garuda systempartition while still keeping and linking the /home directory of/to the data partition.
There is probably already a post or tutorial on this one, yet I havn't found anything (I guess I'm using the wrong keywords...), so if you know/find one please link it to me
There are several topics about it.
This should be a good example:
Or just use the search function.
A simple way to do it would be to rename all of your Btrfs subvolumes, then install the new system into different subvolumes (leaving the old installation intact) using this method: Multiple installations on one partition | Garuda Linux wiki
After the new installation is up, you can copy or move the @home
subvolume from the old installation to the new, and delete any unneeded subvolumes to free up space.
This exact solution is described in another (old) topic here:
Thank you, that's what I was looking for!
But how do I link my new ( old )
/home
partition in the fstab
file?
Will replacing the <type>
-property /home
with /dev/nvme0n1p4
(as fdisk -l
tells me that /dev/nvme0n1p4
is the device I refer to as my /home
directory) work?
The new line will then be:
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /dev/nvme0n1p4 btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
Your UUID represents the partition from where the mounting should take place so no need for /dev/nvme0n1p4 Instead you need to mention the moint point in your fs in it’s place. Like this
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /mnt/point btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
change /mnt/point with where ever you want to mount your drive, in other words the absolute path of the folder you wanna mount this subvolume to.
Ohhh ok so fstab
is already a representation of my subvolumes/partitions? I confused that...
So /root/home
is the absolute path? Or did I get that wrong
UUID is the representation of your partitions, they are used to uniquely identify your drives and their partitions. fstab is a file that ensures your important drives are automounted upon reboot.
usually /home
is the directory where you wanna mount your home subvolume unless you already have a home subvolume mounted on it in which case you can create a new folder and mount the drive there.
There is no such place as /root/home
on your file system unless you have explicitly created it.
I installed garuda without giving it any more specifications than to override my old /root
partition, so in the process it created a home
folder in within the /root
folder. This new home folder is empty so I want to get my old /home
partition to be "inside" it (like it was before the reinstall).
you are confused between /
and /root
they are different. With that out of the way how about
sudo mkdir /oldHome
and using this folder to mount the drive and soft linking the files and folders you want same between the two partitions so that you have same data between the two partitions at any given moment for any files you linked.
OHHHHH
...
yeah I see now...
The problem for me was that my device has (idk why, didn't used to be like that before the reinstall) the name root
:
So replacing /home with /oldHome inside the fstab file will be enough?
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /oldHome btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
let's hold your horses, I have a feeling you are about to do something that might not be a good idea. Can you send us the output of
lsblk -f
and
cat /etc/fstab
lsblk -f
returns:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
└─sda1 vfat FAT16 98A1-9CDC
zram0 [SWAP]
nvme0n1
├─nvme0n1p1 vfat FAT32 4349-0B32 510,4M 0% /boot/efi
├─nvme0n1p2 swap 1 29180c25-a121-4927-94dd-12a443c0ecf8 [SWAP]
├─nvme0n1p3 btrfs ea4a266b-60ce-41dd-9393-1eedd5574380 93,9G 21% /var/tmp
│ /var/log
│ /var/cache
│ /srv
│ /root
│ /home
│ /
└─nvme0n1p4 btrfs 3d89578c-aea0-4575-b636-86ae3ea88d0a 15,1G 95% /run/media/stk/3d89578c-aea0-4575-b636-86ae3ea88d0a
and cat /etc/fstab
returns:
File: /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=4349-0B32 /boot/efi vfat defaults,noatime 0 2
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 / btrfs subvol=/@,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /home btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /root btrfs subvol=/@root,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /srv btrfs subvol=/@srv,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /var/cache btrfs subvol=/@cache,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /var/log btrfs subvol=/@log,defaults,noatime,compress=zstd 0 0
UUID=ea4a266b-60ce-41dd-9393-1eedd5574380 /var/tmp btrfs subvol=/@tmp,defaults,noatime,compress=zstd 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
Just to confirm your "old" home subvolume resides on nvme0n1p4 right?
Yes, as you can see an the screenshot above. It's the 340GiB one.
There are a few mistakes then, why are you using the UUID of your newly created partition nvme0n1p3, you already have it’s home subvolume mounted and it’s empty, you want your old subvolume right? There are two ways I can think you can do this,
- You can change this line in your /etc/fstab
to this,
UUID=3d89578c-aea0-4575-b636-86ae3ea88d0a /home btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
Notice I changed the UUID of disk here to point to your old partition instead. But there is a certain risk to this, I have no idea if you would be able to login to your system after this. There is a high possibilty that you might need to chroot and access this file again to revert the changes.
- A much safer way would be
In your /etc/fstab add this line at the end of the file
UUID=3d89578c-aea0-4575-b636-86ae3ea88d0a /oldHome btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
and save it. Then,
sudo mkdir /oldHome
then reboot. Once done, check you can access your old home subvolume with
ls /oldHome
it would likely contain a folder with your user name as it’s name you can access it’s contents. You can then go about symlinking the contents of your old home subvolume with the new one like this
for example the ~/.config folder, You can first
mv ~/.config ~/.config.bak
so that in case anything goes wrong you have a backup, and then
ln -s /oldHome/oldusrname/.config ~/.config
replace oldusrname with whatever is there in the /oldHome folder
will softlink the .config folder from your oldHome to your new home and all files and changes will be synced between them.
You can do same for other files as you see fit.
UUID=3d89578c-aea0-4575-b636-86ae3ea88d0a /oldHome btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
After I rebooted with this at the end of my fstab it throwed an error at me and I had to remove it (in emergency mode) to boot again.
did you create the /oldHome
dir using
sudo mkdir /oldHome
before rebooting? It yes, then what was the error can you tell us?
It was already existing, I used the command when you mentioned it earlier.
that's extremely strange, can you tell us what the error was?
[FAILED] Failed to mount /oldHome
[DEPEND] Dependency failed for Local File Systems