2
I have a broken lxd installation and want to completely delete it and start over, but there's a problem. /var/lib/lxd/devices/desktop contains a bunch of subdirs that are linked to directories elsewhere in the filesystem (even on different drives) such as
drwxr-xr-x 28 karl karl 4096 Apr 11 15:40 disk.shareName.home-karl
drwxr-xr-x 4 nobody nogroup 4096 Apr 14 12:07 disk.thor.mnt-thor
drwxr-xr-x 2 root root 4096 Mar 29 14:02 disk.usbdrive.mnt-usbdrive
For example, if I delete a file from disk.thor.mnt-thor, it also gets deleted from /home/storage (both directories point to the same place). disk.usbdrive.mnt-usbdrive shows all contents of my usb drive mounted to /mnt/usbdrive. Both directories show its contents, and modifications in one are reflected in the other.
But now if I want to delete these directories, I have a problem, because I just want to remove those directories under lxd, not the actual directories they point to and not their contents. I tried using unlink
, but it doesn't work on directories.
If they were hardlinks,
rm
would just remove the link, and the link reference count on the destination would decrease by one. – tripleee – 2018-04-14T12:25:51.620