Jump to content
IGNORED

linux help!


kcinsu

Recommended Posts

can anyone tell me the file in the /proc directory that will tell me the size of each hard disk?

 

google returns a plethora of confusing threads on various forums, but nothing concrete. surely this information is stored in a specific location?

 

and please don't tell me a command line solution... I need to know the actual file that contains this info.

 

please obi watmm kenobi... you're my only hope.

Link to comment
Share on other sites

ok, so after trying to read up on blocks, it seems there is no standard block size. Is there a way to find out the current systems block size? I found tune2fs -l as a way to check from root, but I need to find the information on a machine in which I am not the admin, and apparently tune2fs -l can only be called from root?

Link to comment
Share on other sites

including mounted and unmounted drives and mounted and unmounted partitions? Are you only allowed to use /proc for this info? Imma go over to my linux partition and try to figure it out cause im bored, be back in a sec...

 

EDIT: does your particular system have a /proc/ide/ by any chance? Is this a school assignment?

 

EDIT2: Linux refers to blocks as 1024 Bytes, so you can either use this for /proc/partitions or you can use sysfs. /sys/ is fairly new in the kernel but it contains some info about devices that has been deprecated from the kernel, including /proc/ide which isn't supported anymore. /sys/block/XXdevicenameXX(hda, sda, etc...)/size will give you the size of the drive in sectors and is the replacement for /proc/ide/device_name/size

 

 

sectors are 512B

Link to comment
Share on other sites

Yeah, we are only supposed to use /proc (yes, a school assignment... basically I am writing methods that access these files, and returns various info about the OS, the CPUs, the disks, and the memory etc)

 

answer to edit1: yes there is /proc/ide but the only file in there is called drivers which has 2 lines of text that is definitely not what i'm looking for

 

there is a sys as well, but no block or similar file path

 

I guess I'll have to just take the block size, and multiply it by 1024?

 

thanks for your help.

 

this class is getting on my nerves... he keeps assigning projects that require knowledge that he doesn't teach us in class. pretty much every assignment is like this, and I end up spending hours and hours online teaching myself everything I need to make the program work. sure it's great experience, and it's proven that I can figure stuff out on my (watmm's) own... but fuck, there is only so many free hours in a week outside of a full time job, and my other project classes. And he gets annoyed if you ask him too many questions. The pre-req for this class is a tad optimistic I think...

Link to comment
Share on other sites

yeah it's annoying. I've noticed some professors fail to acknowledge that certain specs of the linux kernel are way different then they were 10 years ago and expect everything to work the same. Also distros customize their kernels differently, there are all sorts of options on stuff you can include in proc.

 

also check out /proc/diskstats which doesn't have any info about size but it does have lots of interesting numbers about disk access and shit can't remember exactly what.

Link to comment
Share on other sites

cool, thanks!

 

Also, 2 classes ago, he went on a rant about never hardcoding a file path. But for this assignment we have to. :facepalm:

 

Unless he wants me to write a method that checks to see if /proc exists, and if it does, check to see if every subdirectory exists, and if it does, check to see if these files exist. Fuck that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.