Disappearing Directory

Home » CentOS » Disappearing Directory
CentOS 15 Comments

Hi All and happy new year,

Via a cron job a USB disk is mounted on a CentOS 6.4 machine for backup and dismounted after. I’ve noticed this failing. See below, the backup directory that was in /mnt had disappeared, so creating it again as follows…

# cd /mnt
# mkdir backup
# mount /dev/sdb1 /mnt/backup/
# ls backup
# cd backup/
# ls boot.tar.gz etc etc.tar.gz home home.tar.gz ident.txt lost+found
named.tar.gz root.tar.gz usr.tar.gz var var.tar.gz
# cd ..
# ls backup
# umount /dev/sdb1
# ls

# cat /etc/redhat-release CentOS release 6.4 (Final)

After the umount the directory vanishes. What gives or have I lost the plot in 2014. (This works as I’d expect on an old fc14 system I have)

:-) Ken

15 thoughts on - Disappearing Directory

  • Ken Smith wrote:

    Before I’m asked, no there’s nothing helpful in messages except advice to run fsck on the external disk as its a while since that was done

    :-) Ken

  • I’d guess that something is rm-ing the mount point while it’s mounted, so that when you umount it, it disappears.

  • Fred Smith wrote:
    The bash commands in the earlier post are manually entered in a terminal. The cron job isn’t active. Even if I set the file read only it vanishes ( eg chmod 500 /mnt/backup). Bug in umount?

    :-( Ken

  • Even though it is a workaround – I myself like to use
    /export/backup — I do not think that solves the original question. At work our fileserver, an ubuntu box, mounts its backup drive into
    /mnt/backup just like Ken wants to do. And it works exactly as he wants. I wonder if something is doing housecleaning in /mnt.

  • Am 03.01.2014 um 08:57 schrieb Mauricio Tavares :

    thats why i suggest to try it in backup. Thats not a solution, it is more a heuristic way to get close to the problem (after evaluating the results).

  • Leon Fauster wrote:
    {snip}
    I tried it in /media. Same result. Its as if umount is doing a rm -rf

    :-( Ken

  • Am 03.01.2014 um 15:04 schrieb Ken Smith :

    please try /backup, /test or /random or something that is not /mnt or /media. The latter dirs are common to be under control by some “processes”.

  • Also try to use /bin/umount instead of just umount. That way you prevent a potential alias for “umount” from running instead of the actual command.

    Regards,
    Dennis

  • Fred Smith writes:

    What does mount say is mounted after running your backup script? An explanation is that the script mounts something directly on /mnt and it’s still mounted after the script runs. Unmount that (there may be several if you’ve been playing with it for a while).

    Cheers, Dave

  • Dennis Jacobfeuerborn wrote:

    OK result. I created /TEST and mounted and umounted successfully with both /bin/umount and plain umount

    Interesting, as suspected something is messing with things in /mnt and
    /media

    Ken

  • Ken Smith wrote:

    After a reboot all returns to normal. Very strange. Thanks for all the replies.

    BTW: The crude backup script mounts the external USB device, checks for a specific file in the root of the external device to verify the right thing is mounted, runs the backup with various rsync incantations and then dismounts the external disk. Very simple and basic and working again… :-) Ken