Skip to contentSkip to conversation

updating mtime for char/block devices?

DISCUSSION Carl-Daniel Hailfinger 4 participants 7 messages Feb 28, 2005 – Mar 1, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

is it intentional that
echo foo >/dev/hda1
doesn't update the mtime of the device node, but
echo foo >/dev/tty10
does update the mtime of the device node?

And no, mounting with the noatime flag doesn't help because the mtime is updated. IIRC some time ago this behaviour was different, but I could easily be mistaken.

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#1 lore raw
Quoted 11 lines · Carl-Daniel Hailfinger

Hi,

is it intentional that
echo foo >/dev/hda1
doesn't update the mtime of the device node, but
echo foo >/dev/tty10
does update the mtime of the device node?

And no, mounting with the noatime flag doesn't help because the mtime is updated. IIRC some time ago this behaviour was different, but I could easily be mistaken.

devices are tricky in general in this respect, /dev may be mounted read only for example ;)

#2 lore raw
Quoted 10 lines · Arjan van de Ven
Quoted 8 lines · Carl-Daniel Hailfinger

Hi,

is it intentional that
echo foo >/dev/hda1
doesn't update the mtime of the device node, but
echo foo >/dev/tty10
does update the mtime of the device node?

Quoted 7 lines
Quoted 3 lines

And no, mounting with the noatime flag doesn't help because the mtime is updated. IIRC some time ago this behaviour was different, but I could easily be mistaken.

devices are tricky in general in this respect, /dev may be mounted read only for example ;)

Sorry for not specifying my real problem which is preventing disk access when my laptop is running on battery.

Can I prevent mtime updates for all device files? Mounting /dev readonly would certainly help, but for that to work I'd have to move /dev to a different filesystem, right?

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#3 lore raw
Quoted 6 lines · Carl-Daniel Hailfinger

Sorry for not specifying my real problem which is preventing disk access when my laptop is running on battery.

Can I prevent mtime updates for all device files? Mounting /dev readonly would certainly help, but for that to work I'd have to move /dev to a different filesystem, right?

Or do what Fedora Core 3 does and use 'udev' to manage a /dev on a tmpfs file system.

#4 lore raw
In reply to Carl-Daniel Hailfinger
Quoted 3 lines · Carl-Daniel Hailfinger

Can I prevent mtime updates for all device files? Mounting /dev readonly would certainly help, but for that to work I'd have to move /dev to a different filesystem, right?

tty mtime updates aren't marked dirty, so aren't written back to disk. Intentionally.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#5 lore raw
Quoted 9 lines · Russell King
Quoted 3 lines · Carl-Daniel Hailfinger

Can I prevent mtime updates for all device files? Mounting /dev readonly would certainly help, but for that to work I'd have to move /dev to a different filesystem, right?

tty mtime updates aren't marked dirty, so aren't written back to disk. Intentionally.

It seems the tty mtime exception doesn't include /dev/ptmx. That's probably unintentional. Is there a chance to extend the tty mtime exception to all char devices or at least major 4+5?

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#6 lore raw
Quoted 7 lines · Carl-Daniel Hailfinger
Quoted 2 lines · Russell King

tty mtime updates aren't marked dirty, so aren't written back to disk. Intentionally.

It seems the tty mtime exception doesn't include /dev/ptmx. That's probably unintentional. Is there a chance to extend the tty mtime exception to all char devices or at least major 4+5?

It does include /dev/ptmx, at least here with 2.6.11-rc2-bk1 and 2.4 kernels. In fact, it's common to all tty devices since it's handled by the generic tty code.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core