Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Distribution: Fedora, OpenSuse, DENX Embedded Linux
Calculate usable bytes on a disk partition?
How do you calculate the number of usable bytes on a disk partition? When I do an fdisk -l I get this:
Disk /dev/md0: 192.0 GB, 192069500928 bytes
2 heads, 4 sectors/track, 46891968 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Device Boot Start End Blocks Id System
/dev/md0p1 1 23445984 93783935+ 83 Linux
/dev/md0p2 23445985 46891968 93783936 83 Linux
The number of usable bytes for /dev/md0 is clearly displayed as 192069500928 bytes. Also calculating the number of bytes form the number of cylinders seems to be valid as well (192069500928 = 46891968 * 4096). My test program is happy when trying to access all 192069500928 bytes. When I try to do the same calculation on /dev/md0p2 I get (46891968-23445985)*4096 = 96034746368 bytes. Even though this value seems reasonable, it doesn't seem like all 96034746368 bytes are usable since my test program gets errors when trying to access all 96034746368 bytes.
Does anyone know how to calculate the number "usable" bytes on a disk partition?
Further to this, depending on the filesystem, you may (or not) have reserved blocks, and you will certainly have metadata that is stored in the filesystem.
dumpe2fs will give you some idea of the type of things you need to account for in ext2/3/4.