From: Terry Michaels Date: 2010-10-16T12:58:33+09:00 Subject: Re: Getting the size of a block device Joel VanderWerf wrote in post #946983: > On 10/09/2010 05:35 AM, Brian Candler wrote: >> Terry Michaels wrote: >>> Obviously, I could wrap a system call around a Linux utility or read a >>> proc file... but I am curious if there is a 'built-in' Ruby method. >> >> The ioctl is called BLKGETSIZE/BLKGETSIZE64, and a quick grep of the >> ruby source code doesn't find it. >> >> Maybe someone else has published an extension which wraps the API >> directly, but you could just use IO.ioctl directly. > > Does the sys-filesystem gem have something like that? > > http://rubyforge.org/docman/view.php/610/1562/sys-filesystem.html I think this only tells the the block size of a mounted file-system. I would want to be able to find the size of any block device passed in to my program. Examples: unformatted hard drive; LVM partition; loop device. -- Posted via http://www.ruby-forum.com/.