Why fdisk/sfdisk (-l) fail to list more than $(ulimit -n) devices in Red Hat Enterprise Linux?

Solution Verified - Updated -

Issue

  • Why fdisk -l reports too many open files if the devices exist default open file limit?

  • It's been noticed that on RHEL systems with a large number of disks(more than default limit 1024 in general) presented, the number of disks shown by fdisk|sfdisk -l is subject to the maximum open filehandle limit.

  • Further analysis with strace reveals that the commands appear to be failing to properly close filehandles as they work through /proc/partitions, thereby causing the open filehandle limit to be reached and the subsequent attempts to process any additional partitions fail silently.

Would the correct behaviour not be for these commands to :

a) Correctly close down filehandles as it processes the partition list?
b) Pass on the 'too many open files' error to the terminal?

Environment

  • Red Hat Enterprise Linux 4,5,6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content