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.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.