Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a pc with no battery backup and using ubuntu 12.04 with ext4 it will constantly ask me to handle the situation by saying that my superblocks last write is in the future.

So I wonder - can I cheat with something like this - setting the time from the superblock before getting in trouble. Is it a dumb idea - and where should I put it?

# set the time based on last mount of disk


[ "${DEVICE}" = "" ] && echo "Won't operate without device" > 2 && exit 3

    sudo dumpe2fs -h $DEVICE |\
    grep 'Last mount time:' |\
    sed 's/^[^:]*: *//'
LAST_MOUNT_YEAR=${LAST_MOUNT_DATE//* } # remove all upto last space

THIS_BOOT_YEAR=${THIS_BOOT_DATE//* } # remove all upto last space

if [[ "$THIS_BOOT_YEAR" < "$LAST_MOUNT_YEAR" ]] ; then
    date -s "$LAST_MOUNT_DATE"
share|improve this question
Can you replace the battery? – Michael Hampton May 19 '13 at 18:06
No such thing - i only have this option currently - or pressing repair each time – Jørgen Gårdsted Jørgensen May 19 '13 at 18:22
Do you have a dead CMOS/clock battery? It's commonly a CR2032 button cell on the motherboard. – Dan D. May 19 '13 at 19:00
Thank You for Your advice - the pc is seemingly born without a battery - a 'pc in a slot' - it will get some sense of real time not too long after startup - just not right away - so I tried 'errors=continue' en /etc/fstab for the drive, but that didn't seem to cut it. So I thought about just having an 'allowed time' (>= last mount time) until I get the right time - which can take a minute or so – Jørgen Gårdsted Jørgensen May 19 '13 at 19:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.