So, I am running Arch on miniature system (the BeagleBone Black). On this board, I have the SD card (/dev/mmcblk1) to pass-through over USB to the host computer with the g_mass_storage kernel module. This works perfectly fine, and any changes I make to this fake USB drive show up immediately in the block device file.

The problem comes with what I want to do with this block device. I want to have it mounted read-only at the document root of an Nginx server. For the most part, this works fine, and any changes I make to the USB drive seem to appear fine on the server root. However, the changes require the block device to be unmounted and remounted before they will appear. Ideally, as soon as I make a change to the USB drive, it would show up at the mount point, but I figured this would be complicated to do.

Is there any simple way to mount a block device in a way that Linux would expect it to be constantly changing, similar to how network mounts like SSH and FTP react to foreign changes?

  • Did you solved it somehow? – Eun Apr 19 '15 at 12:58

A couple of thoughts -

  1. Do you really need to unmount and remount for the changes to appear ? Generally you can use the syntax mount /dev/resource -o remount,ro and mount/dev/resource -o remount,rw to remoount device read only or read-write.

  2. I don't understand the specifics of what you are trying to do, but it sounds like the answer might lie in "udev". In most versions of Linux there is a set of rules (In Ubuntu 12.04 in /etvc/udev/rules.d - I'd expect something similar in many other distros) which map devices and kernel events to things you can act on. (For example I used to detect when an external USB drive was plugged in and runa script. In order to do this you need to work out attributes specific to your block device (Running udevadm info -a -p $(udedm info -q path -n /dev/sdX) and then build a rule using those attributes to craft an action when you detect a change.

    Using UDEV was not hard, but it was quite tricky to get working quite right.

  • Unfortunately, udev rules won't work because that will only give me the ability to update on device actions. I need the block device to be mounted in a way that any changes made are reflected realtime at the mount point. – user1125238 Jan 9 '14 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.