Klaus Knopper answers your Linux questions
Mountpoint Dates
Good day Klaus, I have noticed the following anomaly and would appreciate your comments. All of the following are performed as root.
- I create a new mountpoint with today's date, of course. I mount a device (USB stick or hard drive partition) onto this mountpoint and look at its date. Knoppix 7.3 (also vs. 7.5) in text mode shows 31 Dec 1969. Others (SystemRescueCd, INX, and TRK) show 1 Jan 1970 00h00. Close enough. This minor difference is not the issue. Unmounting the device (
umount
) causes the mountpoint's date to change back to today's date. - An already existing mountpoint will have its own date (e.g., 7 Sep 2012). While a device is mounted here, the mountpoint date shows as 1 Jan 1970 (epoch time?), but after unmounting the device (
umount
), the mountpoint date reverts to its original 7 Sep 2012 date.
Any clarification you can provide for this strange behavior would be much appreciated.
Regards,
Ted
Hello, Ted. Apart from a small time difference between Knoppix and other distros, the effect you described with changing mountpoint dates has a perfectly natural cause.
First, about the time difference: Most computers have a built-in battery-backed clock, so the system knows the correct date and time as soon as its booted up by looking up the BIOS time. The command responsible for that is
sudo hwclock
which will read the hardware registers and show you the clock time, independent of the time known by the running operating system, where the system time can be retrieved by date.
Because there are many timezones on the globe, an offset is added or subtracted by the setting stored in /etc/timezone
. Because Knoppix has no way of knowing where your computer is based geographically without using some kind of network geolocation service (which I don't do because of privacy reasons), the timezone for English versions of Knoppix is preset to UTC (Universal Time).
Your battery-backed clock, on the other hand, is assumed by Knoppix to contain the "local time" – as in most Windows versions (so you get the same time on both OSes) – whereas other distros also use UTC, which may be more common with Unix-ish systems. The timezone difference may explain the time offset when looking at file and directory timestamps.
Metadata such as permissions and dates are stored independently from the file data, so the software writing files may choose not to set any additional information. This would leave permissions and dates in the default state, which is most likely "all bits set to zero," except for the file geometry, which indicates locations and sizes of a file's chunks on the physical device.
If you get a file date display of something like 1.1.1970, it means that the file's timestamp, which is measured in seconds since 1.1.1970 (the "epoch," as you wrote) is set to zero. Some embedded electronic devices do this when storing video and photo data because they have no internal clock from which to get the correct date, or just for simplicity of the file writing algorithms.
Now for the mountpoint dates: The root directory of a filesystem, which is the uppermost directory containing all the files and directories on the partition (and the only one that has no directory name because of its top position in the directory hierarchy), also has permissions and file dates. So, the date displayed for the mountpoint on your system before mounting the partition is just the local date set on that directory. This changes, however, after mounting the filesystem; then, it becomes the date of the root directory set in the mounted filesystem. The original directory permissions and dates of the local mountpoint directory are just shadowed by the mounted device, and they will become visible again after unmounting the filesystem.
If you change the date of the mountpoint while a filesystem mount is active there, you will change that date on the mounted device, not on the local directory. The command
sudo touch /media/sdb1
will set the date of the local directory named /media/sdb1
to the current time in case there is no filesystem mounted there. However, the same command will set the date of the root directory of a mounted device, instead, when issued after the mount
command.
Infos
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.