Jump to content
IGNORED

linux help!


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
https://forum.watmm.com/topic/65392-linux-help/
Share on other sites

  On 4/15/2011 at 2:35 AM, joew said:

/proc/partitions stores the sizes of partitions in blocks

 

so would sum of all the partitions be the total disk size?

Link to comment
https://forum.watmm.com/topic/65392-linux-help/#findComment-1559907
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
https://forum.watmm.com/topic/65392-linux-help/#findComment-1559930
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

Edited by Bubba69
Link to comment
https://forum.watmm.com/topic/65392-linux-help/#findComment-1560047
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
https://forum.watmm.com/topic/65392-linux-help/#findComment-1560090
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.

Edited by Bubba69
Link to comment
https://forum.watmm.com/topic/65392-linux-help/#findComment-1560096
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
https://forum.watmm.com/topic/65392-linux-help/#findComment-1560098
Share on other sites

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   1 Member

×
×