You are not logged in.
Pages: 1
Topic closed
I'd like to restrict thunar from showing partitions that aren't mounted under /media but am unfamiliar with udev rules. Anyone care to help or to point me in the right direction?
I tried the following but no joy.
#! /bin/bash
cat > /etc/udev/rules.d/99-hide-partitions.rules << EOFHPRULES
ACTION!="add|change", GOTO="hide_partition_end"
SUBSYSTEM!="block", GOTO="hide_partition_end"
KERNEL=="loop*|ram*", GOTO="hide_partition_end"
ENV{UDISKS_PARTITION_SCHEME}=="mbr", ENV{UDISKS_PARTITION_TYPE}=="0xa5|0xa6|0xa9", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_TYPE}=="ufs", ENV{UDISKS_PRESENTATION_HIDE}="1"
`awk '/noauto/&&/ext[34]|vfat|ntfs/ { sub(/UUID=/,"UUID}==\"", $1) ; printf "ENV{ID_FS_%s\", ENV{UDISKS_PRESENTATION_HIDE}=\"1\"\n", $1 }' /etc/fstab`
LABEL="hide_partition_end"
EOFHPRULES
EDIT: Solution is in post #9.
Last edited by graysky (2011-09-17 10:51:49)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I tried also, but I had no success. After that I added an entry to fstab:
UUID=AAAAAAAAAAAAAAAAAA /mnt/partition-to-hide ext4 noauto 0 0
Offline
A little confusing since the word 'media' appears nowhere in your ruleset... I assume you mean that you don't want thunar to show things mounted in /media?
You'll have better luck parsing the output of something such as findmnt than directly hitting /etc/fstab:
findmnt -sruno UUID,TARGET -t ext3,ext4,vfat,ntfs | awk '$2 ~ /^\/media/ { printf "ENV{ID_FS_UUID}==\"%s\", ENV{UDISKS_PRESENTATION_HIDE}=\"1\"\n",$1 }'
Have you checked to see if the UDISKS_PRESENTATION_HIDE tag is actually being applied to the devices in question? You can use udevadm to do this, e.g...
$ udevadm info --query=all -n /dev/sda1
P: /devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
N: sda1
S: disk/by-id/ata-Corsair_CSSD-F80GBP2_10496543320010170008-part1
S: disk/by-id/scsi-SATA_Corsair_CSSD-F810496543320010170008-part1
S: disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part1
S: disk/by-uuid/ea1c4959-406c-45d0-a144-912f4e86b207
S: disk/by-label/boot
S: disk/by-id/wwn-0x5000000000000008-part1
S: disk/by-partuuid/09d74055-8e84-4fb6-b48e-42db29ddc0ee
S: disk/by-partlabel/Linux\x2fWindows\x20data
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
E: MAJOR=8
E: MINOR=1
E: DEVNAME=/dev/sda1
E: DEVTYPE=partition
E: SUBSYSTEM=block
E: ID_ATA=1
E: ID_TYPE=disk
E: ID_BUS=ata
E: ID_MODEL=Corsair_CSSD-F80GBP2
E: ID_MODEL_ENC=Corsair\x20CSSD-F80GBP2\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_REVISION=2.0
E: ID_SERIAL=Corsair_CSSD-F80GBP2_10496543320010170008
E: ID_SERIAL_SHORT=10496543320010170008
E: ID_ATA_WRITE_CACHE=1
E: ID_ATA_WRITE_CACHE_ENABLED=1
E: ID_ATA_FEATURE_SET_HPA=1
E: ID_ATA_FEATURE_SET_HPA_ENABLED=0
E: ID_ATA_FEATURE_SET_PM=1
E: ID_ATA_FEATURE_SET_PM_ENABLED=1
E: ID_ATA_FEATURE_SET_SECURITY=1
E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=400
E: ID_ATA_FEATURE_SET_SMART=1
E: ID_ATA_FEATURE_SET_SMART_ENABLED=1
E: ID_ATA_DOWNLOAD_MICROCODE=1
E: ID_ATA_SATA=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1
E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
E: ID_ATA_ROTATION_RATE_RPM=0
E: ID_WWN=0x5000000000000008
E: ID_WWN_WITH_EXTENSION=0x5000000000000008
E: ID_SCSI_COMPAT=SATA_Corsair_CSSD-F810496543320010170008
E: ID_PATH=pci-0000:00:1f.2-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_1f_2-scsi-0_0_0_0
E: ID_PART_TABLE_TYPE=gpt
E: ID_FS_LABEL=boot
E: ID_FS_LABEL_ENC=boot
E: ID_FS_UUID=ea1c4959-406c-45d0-a144-912f4e86b207
E: ID_FS_UUID_ENC=ea1c4959-406c-45d0-a144-912f4e86b207
E: ID_FS_SEC_TYPE=ext2
E: ID_FS_VERSION=1.0
E: ID_FS_TYPE=ext3
E: ID_FS_USAGE=filesystem
E: ID_PART_ENTRY_SCHEME=gpt
E: ID_PART_ENTRY_NAME=Linux\x2fWindows\x20data
E: ID_PART_ENTRY_UUID=09d74055-8e84-4fb6-b48e-42db29ddc0ee
E: ID_PART_ENTRY_TYPE=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
E: ID_PART_ENTRY_FLAGS=0x4
E: ID_PART_ENTRY_NUMBER=1
E: ID_PART_ENTRY_OFFSET=4096
E: ID_PART_ENTRY_SIZE=204800
E: ID_PART_ENTRY_DISK=8:0
E: UDISKS_PRESENTATION_NOPOLICY=0
E: UDISKS_PARTITION=1
E: UDISKS_PARTITION_SCHEME=gpt
E: UDISKS_PARTITION_NUMBER=1
E: UDISKS_PARTITION_TYPE=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
E: UDISKS_PARTITION_SIZE=104857600
E: UDISKS_PARTITION_LABEL=Linux/Windows data
E: UDISKS_PARTITION_UUID=09D74055-8E84-4FB6-B48E-42DB29DDC0EE
E: UDISKS_PARTITION_SLAVE=/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
E: UDISKS_PARTITION_OFFSET=2097152
E: UDISKS_PARTITION_ALIGNMENT_OFFSET=0
E: DEVLINKS=/dev/disk/by-id/ata-Corsair_CSSD-F80GBP2_10496543320010170008-part1 /dev/disk/by-id/scsi-SATA_Corsair_CSSD-F810496543320010170008-part1 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part1 /dev/disk/by-uuid/ea1c4959-406c-45d0-a144-912f4e86b207 /dev/disk/by-label/boot /dev/disk/by-id/wwn-0x5000000000000008-part1 /dev/disk/by-partuuid/09d74055-8e84-4fb6-b48e-42db29ddc0ee /dev/disk/by-partlabel/Linux\x2fWindows\x20data
E: TAGS=:systemd:
Offline
@falconinfy - sorry, I was too vague.
Problem #1) I have several partitions that hold backup and other distros which I don't want to be hidden, namely: /dev/sda4 /dev/sda6 /dev/sda8
I made this rule but found that these partitions were still showing up in thunar after a logout/login and after a "udevadm control --reload-rules"
KERNEL==”/dev/sda4“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
KERNEL==”/dev/sda6“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
KERNEL==”/dev/sda8“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
EDIT: After a reboot, I still see these in the sidebar AND thunar freezes as soon as I launch it
Problem #2) I have another partition that I wish NOT to hide: /dev/sda7 which is in my /etc/fstab (ntfs-3g) that is automounted to /media/data at boot. Problem here is that I want a nice clickable button for it in thunar's side panel but it is not there by default. That said, USB thumb drives are autodetected and mounted just fine. They DO appear in the thunar side panel.
Thanks for any advice!
Last edited by graysky (2011-08-13 16:32:08)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
@graysky Would you mind to rename this thread to The Official UDEV Rules HelpDesk Topic or something because I'd have a question, too, but don't want to hijack your thread?
Offline
User sessions have nothing to do with udev applying environment vars to sysfs nodes. This happens at node creation (aka boot).
Reloading rules is generally bunk, as udev keeps inotify watches on its rules directories. Changes are picked up automagically when they happen.
Your KERNEL matches seem bunk. The /dev prefix isn't wanted, e.g. from 60-persistent-storage.rules:
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode"
Note that you're matching on node name alone, with no regard for where the devtmpfs is.
Last edited by falconindy (2011-08-13 16:42:37)
Offline
Hmm... perhaps I've made this entire thread more complex than it needs to be...
Goal: make thunar's sidebar only show mounted partitions. To keep things simple, only show a button if a partition is mounted under /media
Can I achieve this with a udev rule or multiple udev rules? Is there a better way to implement the behavior?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I found this thread and tried it, but I get no effect. In other words, these partitions are still in thunar and I can still interact with them.
# cat /etc/udev/rules.d/92-hide-partitions.rules
ACTION!="add|change", GOTO="hide_partitions_end"
SUBSYSTEM!="block", GOTO="hide_partitions_end"
KERNEL=="loop*|ram*", GOTO="hide_partitions_end"
KERNEL==”sda4“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
KERNEL==”sda6“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
KERNEL==”sda8“, ENV{UDISKS_PRESENTATION_HIDE}=”1″
LABEL="hide_partitions_end"
That link suggested refreshing udev via:
# udevadm trigger
Which promptly logged me out. Upon logging back in, I saw no change in the behavior. Thunar could still see the drive partitions.
I also found this thread which teaches by uuid, for my system:
ENV{ID_FS_UUID}=="e1c45bf7-5da9-4010-89dc-04d2016a6373", ENV{UDISKS_PRESENTATION_HIDE}:="1
ENV{ID_FS_UUID}=="f01ad1b9-427a-48ee-54e1-198a195b7e16", ENV{UDISKS_PRESENTATION_HIDE}:="1
ENV{ID_FS_UUID}=="458ab543-0614-422d-b79f-2b873630e9fd", ENV{UDISKS_PRESENTATION_HIDE}:="1
I redid the "udevadm trigger" command and again upon logging back in, I saw no change in the behavior. Thunar could still see the drive partitions.
Advice is welcomed.
Last edited by graysky (2011-09-04 06:20:07)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Finally got this working; note the invalid " characters in my post above. They came from me pasting from the source that advised me how to do this.
# cat /etc/udev/rules.d/hide-partitions.rules
KERNEL=="sda3",ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda4",ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda6",ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda8",ENV{UDISKS_PRESENTATION_HIDE}="1"
Last edited by graysky (2011-09-10 15:35:04)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I am running Arch on an ARM Chromebook, and I have two partitions on the disk: one for the kernel (needed by u-boot) at /dev/mmcblk0p1, and other one for the system at /dev/mmcblk0p2. I tried hiding the boot partition icon in my desktop, by creating a file /etc/udev/rules.d/10-local-rules with the following contents:
KERNEL=="mmcblk0p1", ENV{UDISKS_PRESENTATION_HIDE}="1"
Rebooted and the partition icon is still shown on my XFCE desktop . Why didn't this work, is this method obsolete? Am I missing something?
Offline
doragasu,
A couple problems. First, this is an old thread and much has changed in the last couple years. Second, as much as I like the ARM processor, these forums are specifically focused on Arch Linux (an x86 / x86_64 based distribution). I am afraid you need to take your questions to the Arch Arm forums; they are an independent distribution. Thanks.
https://wiki.archlinux.org/index.php/Fo … Bumping.22
https://wiki.archlinux.org/index.php/Fo … pport_ONLY
Closing
Last edited by ewaller (2013-07-03 14:37:35)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed