I recently switched to Fedora. (Fedora 36 GNOME). I manually partitioned my ssd: btrfs with @/ and @/home.
To backup my system I use Timeshift. Only @/ is backuped.
Now I installed QEMU and VirtManager and saw, that all the files are on @/. (Formerly I used Virtualbox and there was a folder in $HOME for that…)
I moved the qcow2-images in my $HOME folder. But the other things are still in @/.
The snapshots I do with VirtManager are stored in this qcow2-files, so the snapshots itself are in my $HOME-folder, is that right?
I’m afraid, that a rollback with timeshift could make problems to the configuration of the virtual machines or the snapshots (I saw xml-snapshot-files in a subfolder of /var/lib/libvirt. That is necessary to know which snapshots are done in the qcow2-image, am I right?)
What should I do further, to avoid problems with a timeshift-rollback?
IMO, the easiest solution is to create a subvolume where the VMs are stored by default. That will exclude that location from your snapshots since it will be in a separate subvol.
I already considered that. But I already moved the qcow2 files to a separate folder in $HOME. So it wouldn’t make a difference I think.
But my question is, if there are any other files, where changes could break the VM.
If I would do a rollback with timeshift, all data except the qcow2 files would set to a former state. And I am afraid, that there could be problems.
E.g. when I did a VM-snapshot and do a timeshift-rollback to a timeshift-snapshot from before the VM-snapshot was done, the VM-snapshot is in the qcow2 file but the VM-snapshot-xml-file in /var/lib/libvirt/qemu/snapshot/VMNAME is removed. That would be a problem, or not? Are there other files which could make problems?
After executing them, I have run sudo btrfs subvolume list / and the result was:
ID 256 gen 5964 top level 5 path @home
ID 257 gen 5964 top level 5 path @
ID 258 gen 5935 top level 257 path var/lib/machines
ID 263 gen 5957 top level 257 path var/lib/libvirt
ID 264 gen 5940 top level 5 path timeshift-btrfs/snapshots/2022-08-15_12-47-40/@
It seems that var/lib/machines was already created automatically. But there are only the qcow2 images in it. Now the whole libvirt is excluded from changes by timeshift.
Timeshift does only snapshots of root, right? All other subvolumes are excluded except of home, when you set the checkbox “Include @home” (I didn’t set it…)
I wonder only because there is no other checkbox except for the inclusion of home subvolume.
But now I have another problem: the libvirtd.service doesn’t start anymore at startup. I did a sudo systemctl enable libvirtd and sudo systemctl start libvirtd but after restart it’s again inactive (dead):
I have a big problem! I had to restore a Timeshift-Snapshot because of problems with the video-driver and now my whole /var/lib/libvirt folder is empty!
Timeshift had only to change @, not @home or @vm.
But @vm does not appear anymore in the subvolumes list:
sudo btrfs subvolume list /
results in:
ID 256 gen 83183 top level 5 path @home
ID 257 gen 83178 top level 5 path timeshift-btrfs/snapshots/2022-12-15_18-16-50/@
ID 258 gen 82703 top level 257 path timeshift-btrfs/snapshots/2022-12-15_18-16-50/@/var/lib/machines
ID 263 gen 82703 top level 257 path timeshift-btrfs/snapshots/2022-12-15_18-16-50/@/var/lib/libvirt
ID 265 gen 82674 top level 5 path timeshift-btrfs/snapshots/2022-08-16_12-40-58/@
ID 270 gen 82674 top level 5 path timeshift-btrfs/snapshots/2022-09-08_10-12-19/@
ID 277 gen 82674 top level 5 path timeshift-btrfs/snapshots/2022-10-16_13-00-02/@
ID 282 gen 82674 top level 5 path timeshift-btrfs/snapshots/2022-11-16_19-00-01/@
ID 285 gen 82674 top level 5 path timeshift-btrfs/snapshots/2022-12-02_18-00-02/@
ID 286 gen 83178 top level 5 path timeshift-btrfs/snapshots/2022-12-09_20-00-01/@
ID 287 gen 83183 top level 5 path @
And the commands as seen result in:
$ sudo systemctl start libvirtd
$ sudo systemctl status libvirtd
○ libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Thu 2022-12-15 22:21:10 CET; 4s ago
TriggeredBy: ○ libvirtd-tcp.socket
● libvirtd-admin.socket
● libvirtd.socket
● libvirtd-ro.socket
○ libvirtd-tls.socket
Docs: man:libvirtd(8)
https://libvirt.org
Process: 5907 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 5907 (code=exited, status=0/SUCCESS)
CPU: 86ms
Dez 15 22:21:10 pc systemd[1]: Starting libvirtd.service - Virtualization daemon...
Dez 15 22:21:10 pc systemd[1]: Started libvirtd.service - Virtualization daemon.
Dez 15 22:21:10 pc libvirtd[5907]: libvirt version: 8.1.0, package: 2.fc36 (Fedora Project, 2022-03-13-01:12:58, )
Dez 15 22:21:10 pc libvirtd[5907]: hostname: pc
Dez 15 22:21:10 pc libvirtd[5907]: Failed to create lib dir /var/lib/libvirt/qemu: Die Operation ist nicht erlaubt
Dez 15 22:21:10 pc libvirtd[5907]: Initialisierung des QEMU Status-Treibers fehlgeschlagen: Failed to create lib dir /var/lib/libvirt/qemu: Die Operation ist nicht erlaubt
Dez 15 22:21:10 pc libvirtd[5907]: Treiber Status Initialisierung fehlgeschlagen
Dez 15 22:21:10 pc systemd[1]: libvirtd.service: Deactivated successfully.
Can you please explain, what to write instead of " <mydevice> "?
If I run lsblk the relevant part is:
nvme0n1 259:0 0 476,9G 0 disk
├─nvme0n1p1 259:1 0 476,8M 0 part /boot/efi
└─nvme0n1p2 259:2 0 476,5G 0 part /run/timeshift/backup
/home
/
I tried sudo mount /dev/nvme0n1p2 /mnt -o subvolid=257 but then in /mnt is the whole content of the snapshot, it looks like /. (There is libvirt NOT empty, what is a good news…)
So I can’t execute sudo mv /mnt/timeshift-btrfs/snapshots/2022-12-15_18-16-50/@/var/lib/libvirt /mnt/@/var/lib/libvirt because “there is no such file or directory…”
I tried sudo mount /dev/nvme0n1 /mnt -o subvolid=257 too, but that didn’t work…