I am experiencing some trouble with an external HDD. I'm afraid it is starting to getting corrupted or damaged :S.

In an application I am using statfs to retrieve information of that external HDD:

const char *mountPoint = "/media/hdd";
struct statfs s;
statfs(mountPoint, &s);

However, from time to time, I have noticed in the application logs that the complete Linux system is blocked (in fact, due to not registering some events at the correct times). I have noticed it by myself by typing "df" command in one of these "critical" moments. The effect is that all partitions appear correctly, with exception for the HDD partition, whose line lasts some seconds before appearing.

Furthermore, the HDD is formatted as NTFS and I am using ntfs-3g to operate with it.

...and last but not least I have detected the following problem in dmesg:

klogd: page allocation failure: order:0, mode:0x20
CPU: 0 PID: 1660 Comm: klogd Not tainted 3.12.20-smp #6
Hardware name: PhoenixAward 945GS/945GS, BIOS 6.00 PG 02/03/2015
Call Trace:
[<f866806e>] e1000_alloc_rx_buffers+0x18e/0x1e0 [e1000e]
[<c1a30387>] ? napi_gro_receive+0x67/0x90
[<f8666200>] e1000_clean_rx_irq+0x220/0x340 [e1000e]
[<f866cc5b>] e1000e_poll+0x7b/0x2e0 [e1000e]

I would like to know if there is a non-blocking way of obtaining mounted devices information. In this case, I need the total size of the device and the available or used disk space.

Maybe this problem is not strictly related to "df" or accessing volumen data but it's more related to Linux OS features, such as memory allocation.

Any help would be grateful. Thanks in advance.

  • Is the HDD used with operating systems besides Linux? I have had issues with both USB memory sticks and external HDD if I switch them between Linux and Windows. These days I alwastry and use the network for transfer between disparate OSs. Jul 16, 2015 at 8:32
  • It is an SSD operating under Linux, but formatted as NTFS. Its system is GPT.
    – aloplop85
    Jul 16, 2015 at 8:35

1 Answer 1


Write your logic to extract the device parameters and assign it to a thread/process. Monitor the worker thread/process from the parent process and kill it after a suitable timeout if it is hung.

  • I will also look at VM's dirty ratio and related parameters, such as in this article.
    – aloplop85
    Jul 16, 2015 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.