Freebsd – Hide FreeBSD swap partition in XFCE or KDE file manager

dolphinfreebsdkdethunarxfce

I have just installed a FreeBSD 11.1-RELEASE (amd64) desktop system following the Cooltrainer guide.

For some reason, both XFCE's Thunar and KDE's Dolphin file managers both show an 8 GB device in the devices list (in the panel at the left of the file manager, which, for example, also shows the CD-ROM drive). This device is most likely my swap partition (Thunar does not show the device's name, but Dolphin does show it to be my swap partition /dev/ada0p2). Does anyone know how I can prevent the /dev/ada0p2 swap partition from showing up as a device in the file manager?

My hard disk is partitioned as follows:

% gpart show
=>       40  625142368  ada0  GPT  (298G)
         40       1024     1  freebsd-boot  (512K)
       1064        984        - free -  (492K)
       2048   16777216     2  freebsd-swap  (8.0G)
   16779264  608362496     3  freebsd-zfs  (290G)
  625141760        648        - free -  (324K)

My /etc/fstab is as follows:

% cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ada0p2             none            swap    sw              0       0
proc                    /proc           procfs  rw              0       0
fdesc                   /dev/fd         fdescfs rw,auto,late    0       0

Best Answer

Inspired by this post on the Ubuntu forums, I found out the culprit was the Hardware Abstraction Layer.

I ignored the device in question by creating the following file:

/usr/local/share/hal/fdi/preprobe/20thirdparty/10-ignore-swap.fdi

with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="block.device" string="/dev/ada0p2">
      <merge key="info.ignore" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>

This causes the device to be ignored by the HAL, and to no longer show up in the XFCE or KDE file managers.

Related Question