:: Re: [DNG] For all you automounter p…
Top Page
Delete this message
Reply to this message
Author: Didier Kryn
Date:  
To: dng@lists.dyne.org
Subject: Re: [DNG] For all you automounter programmers
Le 03/05/2016 14:06, Jim Murphy a écrit :
> On Tue, May 3, 2016 at 4:04 AM, Didier Kryn<kryn@???> wrote:
>> Le 02/05/2016 14:12, fsmithred a écrit :
>>> No support for file system labels at this time. If someone can tell me a
>>> reliable way for unprivileged user to get the labels, I'll add it. Feel
>>> free to use these scripts as they are or as motivation to create something
>>> better.
>>>
>>> -fsr
>>>
>>>
>>> On 04/28/2016 01:52 PM, fsmithred wrote:
>>>> On 04/27/2016 08:28 PM, fsmithred wrote:
>>>>> You could get the label from lsblk, do 'pmount label' and it will be
>>>>> mounted at /media/label. Every time you plug in a thumb drive labeled
>>>>> backup, it'll go to the same place. If you unmount the drive,
>>>>> /media/label
>>>>> will no longer exist, so you could even have the backup script check to
>>>>> make sure it's there.
>>>>>
>>>>> -fsr
>>>>>
>>>> Correction - Only root can get the label from lsblk. User can get the
>>>> label from '/sbin/blkid -s LABEL', but only after root has run blkidat
>>>> least once. Other than that, I've now got a script that will handle the
>>>> labels... sometimes.
>>>>
>>>> -fsr
>>>>
>>>>
>> kryn@apcnb98:~$ /sbin/blkid /dev/sda5
>> /dev/sda5: LABEL="/" UUID="d91acaa3-5fdc-49e9-9f2b-ba7f3efb33f9"
>> UUID_SUB="6a0c80cd-5dc6-4135-8018-575686e7e11e" TYPE="btrfs"
>> kryn@apcnb98:~$ /sbin/blkid /dev/sda6
>> /dev/sda6: LABEL="/usr" UUID="05f9f811-b8b1-445f-ac8c-9537a202a9f9"
>> UUID_SUB="52b8e1b8-7080-4696-94e1-8f7580005871" TYPE="btrfs"
>>
>>      Didier
> Problem, blkid uses a cache that is only updated when root runs blkid.
> Any changes are not automatically updated.  A user only sees the cache.

>
> The issues is, fsr is trying to do everything as a "user" so tools like
> lsblk and blkid don't work for this case. For blkid, the cache will not
> be up to date when say a flash-drive is add/or removed.
>
> Jim


     I cannot reproduce what you describe. I just tried it with a usb stick:
kryn@apcnb98:~$ /sbin/blkid /dev/sdb2
/dev/sdb2: LABEL="Didier-Kryn-2" 
UUID="64f73abe-34b9-4d4c-bac7-6dd85f0e4696" TYPE="reiserfs"


     This was done on debian-wheezy, from the console, without any DE 
running, and even display manager stopped, and after a fresh reboot. If 
blkid, invoked by normal user, runs from cache, then it means it has 
been invoked by root after insertion - I suspect udev and consider it a 
good thing, and I can tell you that vdev does systematically invoke 
blkid for every block device.


     Didier