Open BSD Physical Storage

View: New views
7 Messages — Rating Filter:   Alert me  

Open BSD Physical Storage

by Shachi Rai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Currently I am facing a small problem in OpenBSD. I want to get the information about the total physical Storage and the partition table (mounted and unmounted). Please let me know if there is any way out for  getting this information.


Re: Open BSD Physical Storage

by Hannah Schroeter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

On Thu, Dec 06, 2007 at 05:21:08AM -0800, Shachi Rai wrote:
>Currently I am facing a small problem in OpenBSD. I want to get the
>information about the total physical Storage and the partition table
>(mounted and unmounted). Please let me know if there is any way out for
>getting this information.

I don't exactly understand what you really want. But I guess you want to
check which disks exist: grep '^[sw]d' /var/run/dmesg.log (I guess that
should cover most disk devices, save for very exotic stuff and floppy
disks).

For exact information, see fdisk(8), disklabel(8), and df(1). For
potential mounts, see fstab(5), for actual mounts, see mount(8).

Kind regards,

Hannah.


Re: Open BSD Physical Storage

by Josh Grosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 6 Dec 2007 05:21:08 -0800 (PST), Shachi Rai wrote
> Hi,
>
> Currently I am facing a small problem in OpenBSD. I want to get the
> information about the total physical Storage and the partition table
>
> (mounted and unmounted). Please let me know if there is any way out
> for getting this information.

Disklabel information, which includes the physical drive (partition c) can be
obtained from the disklabel(8) command.  If the drive has non-OpenBSD MBR
partitions, *and* the disklabel was built after those MBR partitions were
created, they will have assigned partitions in the disklabel.

Show, in gigabytes, the layout of SCSI drive #0:

# disklabel -p g sd0

Show, in megabytes, the layout of IDE/ATA drive #1:

# disklabel -p m wd1

Show, in gigabytes/megabytes/kilobytes as needed, the capacity and current
utilization of all mounted disks:

$ df -h


Re: Open BSD Physical Storage

by Shachi Rai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Great to see  your reply,

I would like to explain you in detail,

I am currently writing a java code which tries to find out the total physical storage of an OpenBSD machine. Infact I would like to know the complete partition table in an OPenBSD machine.

I have gone through the disklabel and fdisk command but both these command take the device name as a parameter. So my first question would be to know all the devices which are attached and may or may not be mounted. Once this is obtained, I would run the above commands to get the information about each device.

Or

Is there any option which would directly give the complete physical storage information.
Hannah Schroeter wrote:
Hi!

On Thu, Dec 06, 2007 at 05:21:08AM -0800, Shachi Rai wrote:
>Currently I am facing a small problem in OpenBSD. I want to get the
>information about the total physical Storage and the partition table
>(mounted and unmounted). Please let me know if there is any way out for
>getting this information.

I don't exactly understand what you really want. But I guess you want to
check which disks exist: grep '^[sw]d' /var/run/dmesg.log (I guess that
should cover most disk devices, save for very exotic stuff and floppy
disks).

For exact information, see fdisk(8), disklabel(8), and df(1). For
potential mounts, see fstab(5), for actual mounts, see mount(8).

Kind regards,

Hannah.

Re: Open BSD Physical Storage

by Stuart Henderson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2007/12/06 05:57, Shachi Rai wrote:
> I have gone through the disklabel and fdisk command but both these command
> take the device name as a parameter. So my first question would be to know
> all the devices which are attached and may or may not be mounted.

sysctl hw.disknames


Re: Open BSD Physical Storage

by Alexander Hall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Shachi Rai wrote:

> Hi,
>
> Great to see  your reply,
>
> I would like to explain you in detail,
>
> I am currently writing a java code which tries to find out the total
> physical storage of an OpenBSD machine. Infact I would like to know the
> complete partition table in an OPenBSD machine.
>
> I have gone through the disklabel and fdisk command but both these command
> take the device name as a parameter. So my first question would be to know
> all the devices which are attached and may or may not be mounted. Once this
> is obtained, I would run the above commands to get the information about
> each device.

Try `sysctl -n hw.disknames'

then run disklabel on each of them

That might give you what you want.

/Alexander


Re: Open BSD Physical Storage

by Josh Grosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 6 Dec 2007 05:57:17 -0800 (PST), Shachi Rai wrote
> ...So my first question would be
> to know all the devices which are attached...

$ sysctl hw.disknames

> .. and may or may not be
> mounted....

$ df