mkdir -p <dir> hangs

Posted on 2007-08-09
Last Modified: 2010-04-20
Attempting to execute "mkdir -p /home/dfred/app/logdir-2007-08-09" hangs as if deadlocked. The process can not be backgrounded or killed. We've tried this several times. A "ps -ef | grep mkdir" shows:

dfred 27546     1  0 09:54 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 28107     1  0 09:59 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 29676     1  0 10:12 pts/19   00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 29906     1  0 10:15 pts/19   00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 30276     1  0 10:18 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 30405     1  0 10:19 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred 30811     1  0 10:23 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  1238     1  0 10:55 pts/19   00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  3736     1  0 11:23 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  4240     1  0 11:27 pts/106  00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  4404     1  0 11:29 pts/106  00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  5032     1  0 11:35 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09
dfred  5120     1  0 11:35 ?        00:00:00 mkdir -p /home/dfred/app/logdir-2007-08-09

Manually creating the directory works (IE mkdir /home/dfred/app/logdir-2007-08-09). Additional info: several other users are also logged in as dfred and may be accessing the app directory. One of them may have possibly tried to execute the same command even. Could this be the cause of the deadlock?

I greatly appreciate any help in understanding why this command hangs.

uname info: 2.4.21-32.0.1.ELhugemem #1 SMP Tue May 17 17:43:22 EDT 2005 i686 athlon i386 GNU/Linux
Question by:mkatmonkey
    LVL 43

    Accepted Solution

    Can You try
    strace mkdir -p /some/dir
    and see where it hangs?

    Also, verify if there are some hdd/fs errors with command
    LVL 5

    Author Comment


    dmesg showed a couple dozen messages reading:
    nfs: server blah-blah-server not responding, still trying
    nfs: server blah-blah-server OK

    doing strace on 'ls /home' which is also hanging yields this:

    set_thread_area({entry_number:-1 -> 6, base_addr:0xf65ef080, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
    munmap(0xf65f1000, 27419)               = 0
    brk(0)                                  = 0x8a8a000
    brk(0x8aab000)                          = 0x8aab000
    brk(0)                                  = 0x8aab000
    rt_sigaction(SIGTERM, {0x80499b0, [TERM], SA_RESTORER|SA_RESTART, 0x9a4eb8}, {SIG_DFL}, 8) = 0
    rt_sigaction(SIGKILL, {0x80499b0, [KILL], SA_RESTORER|SA_RESTART, 0x9a4eb8}, {SIG_DFL}, 8) = -1 EINVAL (Invalid argument)
    rt_sigaction(SIGSTOP, {0x80499b0, [STOP], SA_RESTORER|SA_RESTART, 0x9a4eb8}, {SIG_DFL}, 8) = -1 EINVAL (Invalid argument)
    ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
    ioctl(1, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
    stat64("../", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fstat64(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

    LVL 34

    Assisted Solution

    by:Duncan Roe
    Looks like your problem is NFS. Depending how you mount NFS disks, it can be the case that attempting an operation on an NFS mounted disk will wait indefinitely for the server to respond. This is actually the normal case. You can mount NFS disks "interruptible" which means an interrupt is honored ... eventually (after quite a long timeout, IIRC).
    LVL 5

    Author Comment

    Our sys admins rebooted the machine. Looks like whatever NFS problems were occurring may have been resolved by another group.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
    In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now