Why updatedb doesn't traverse my external HD?

T.C. Hollingsworth tchollingsworth at gmail.com
Sat Dec 24 20:33:57 UTC 2011


On Sat, Dec 24, 2011 at 11:58 AM, Marko Vojinovic <vvmarko at gmail.com> wrote:
> On Saturday 24 December 2011 12:44:58 G.Wolfe Woodbury wrote:
>> looking at the output of the mount command on F16, it lists tmpfs on
>> /media. This is different from F14 and Gentoo, where /media is a regular
>> directory.
>
> Thanks for pointing this out! :-) Indeed, /media is explicitly mounted, rather
> than being an ordinary directory under /:
>
> [root at Yoda ~]# mount | grep media
> tmpfs on /media type tmpfs
> (rw,nosuid,nodev,noexec,relatime,rootcontext=system_u:object_r:mnt_t:s0,seclabel,mode=755)
> /dev/sdb1 on /media/teraipo type ext4
> (rw,nosuid,nodev,relatime,seclabel,user_xattr,acl,barrier=1,data=ordered,uhelper=udisks)
>
> the external HD is mounted as ext4 on in /media/teraipo, but /media itself is
> mounted(???) as tmpfs, and consequently updatedb doesn't traverse it.
>
>> Look for the start up stuff that makes the mount and disable it, then
>> /media will just be a directory.  However, the USB subsystem may not
>> properly work.
>
> Ok, after a small search I found that systemd mounts the /media directory
> explicitly. The relevant script is:
>
> [root at Yoda ~]# cat /lib/systemd/system/media.mount
> [Unit]
> Description=Media Directory
> Before=local-fs.target
>
> [Mount]
> What=tmpfs
> Where=/media
> Type=tmpfs
> Options=mode=755,nosuid,nodev,noexec
>
> It seems that this was done by design, specifically for this directory. Ok,
> next two questions:
>
> (1) What is the proper place to customize this configuration? I want /media to
> be ext4, so that it doesn't get excluded by updatedb. I know I could
> reconfigure the /lib/systemd/system/media.mount, but that would probably be
> overwritten on update or something. How are these things meant to be
> customized?

Yup, anything in /lib/systemd could get clobbered on update.  Files in
/etc/systemd with the exact same name always override those in /lib,
and /etc/systemd is for sysadmins only; RPM will never mess with
anything there.  To completely disable something in /lib, you "mask"
it:  just symlink /dev/null to an identically named file in /etc.  For
more information, see:
http://0pointer.de/blog/projects/three-levels-of-off.html

So, to disable the /media mount:
ln -sf /dev/null /etc/systemd/system/media.mount

> (2) Why is /media being mounted like this? If I reconfigure it back to ext4, is
> anything else going to break?

For performance reasons.  Since /media is intended for temporary
mounts only, it's faster to keep them in memory (via tmpfs) rather
than hitting the disk every time you need to look one up.

When masking media.mount, /media will revert to being a directory on
your root fs.  So long as it has the appropriate permissions,
everything will still work fine.

-T.C.


More information about the users mailing list