Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Cron and atd jobs cant see manually mounted file systems

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
couling
Posts: 17
Joined: 2010-07-11 10:55

Cron and atd jobs cant see manually mounted file systems

#1 Post by couling »

This has really got me scratching my head so apologies for cross posting the question.

On my raspberry pi, I recently upgraded to debian [/raspbian] buster. Ever since then, cron jobs creating directories using

Code: Select all

mkdir -p <directory name>
will create the directory on the root file system / device instead of the mounted device /backup/. This seems to only apply to manually mounted file systems, not drives listed in /etc/fstab.

I'm absolutely certain that /backup on /dev/sda2 (aka "/") is empty. I'm pretty certain that I'm mounting my USB drive correctly (mount /dev/disk/by-label/BACKUP1 /backup)

Does anyone have any idea what is going on here?




Steps to Reproduce


As root:

Code: Select all

    # mkdir /backup
    # mount /dev/sdb1 /backup
    # mkdir -p /backup/mars/foo
    # batch << EOF
    # mkdir -p /backup/mars/bar
    > ls /backup/mars > /tmp/mount.test.log
    > EOF
Wait for the script to end.

Expected

Code: Select all

    # ls /backup/mars
    foo bar
    # cat /tmp/mount.test.log
    foo bar
    # umount /backup
    # ls /backup/mars
    ls: cannot access '/backup/mars': No such file or directory
Actual Behaviour

Code: Select all

    # ls /backup/mars
    foo
    # cat /tmp/mount.test.log
    bar
    # umount /backup
    # ls /backup/mars
    bar

couling
Posts: 17
Joined: 2010-07-11 10:55

Re: Cron and atd jobs cant see manually mounted file systems

#2 Post by couling »

Update... I've also discovered that running `mount > /tmp/mount.test.log 2>&1` as a cron job is also missing the the file system I mounted.

couling
Posts: 17
Joined: 2010-07-11 10:55

Re: Cron and atd jobs cant see manually mounted file systems

#3 Post by couling »

More info. Looks like this is being caused by the two processes (crond and sshd) being in separate namespaces for mount (/proc/[pid]/ns/mnt has a different pointer for each).

If anyone knows why, or better how to stop it happening, that would be great.

Post Reply