Skip to content

Tag: disk

How does Linux Kernel know disk capacity? (at boot time)

I know that in linux environment, we can check the disk capacity (e.g. in units of the number of sectors) through commands such as df or fdisk. But, as far as I know, such a command seems to “read disk capacity information already loaded in memory”. (Not asking the disk directly for capacity) If s…

Immutable names in /dev/disk

There are four entries in /dev/disk which I am interested in. by-id by-label by-path by-uuid Which of the entries contain immutable names for physical drives? By immutable, I mean that the name shouldn’t change if I change the usb/pci port used to connect to the drive. destroy and create partitions (GPT…

Get hardware information from /proc filesytem in Linux

I use execv to run lshw command to get the CPU, disk, and memory in C code. But I would like to search another solution to get these information from /proc or any other existed data. Have any suggestion? Here is my code: Linux command: $ sudo lshw -short -c disk -c processor -c memory I have two questions: Wh…

Force write of a file to disk

I’m currently implementing a ping/pong buffering scheme to safely write a file to disk. I’m using C++/Boost on a Linux/CentOS machine. Now I’m facing the problem to force the actual write of the file to disk. Is it possible to do so irrespective of all the caching policies of the filesystem …