LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 07-16-2003, 08:55 AM   #1
dvong3
Member
 
Registered: Sep 2002
Posts: 168

Rep: Reputation: 30
Arrow Kilobytes vs block


How do read blocks in filesystem? What is the conversion to bytes to block or vice versa?
 
Old 07-16-2003, 09:24 AM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
if i had to guess just by looking at the information that i see in a fdisk -l command i would say that you multiply the amount of blocks by 2 and then multiply that number by 512, to get the amount of bytes....these equations i am presenting are all with the assumption that there is 512 bytes per sector.
this could be totally wrong, its just how i believe that it could be done.
or if you look at the ending sector of a drive you could subtract 1, divide by two and multiply by 512.
again these equations are something i am just throwing together by looking at numbers in front of me, they could be totally wrong or pretty accurate, i do not know, so i guess you can wait till someone else posts an answer...
 
Old 07-16-2003, 09:30 AM   #3
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
The blocks/bytes ratio depends on how you've set up your filesystem at format time. Popular blocksizes are : 1024, 2048 and 4096 bytes. On the other hand low level utils like cpio assume a blocksize of 512 bytes, so maybe there are some historical anomalies that some guru can shed light on ?

To read raw blocks you could look into the dd util, or cpio in copy-pass mode.

Last edited by Pres; 07-16-2003 at 09:35 AM.
 
Old 07-16-2003, 10:06 AM   #4
dvong3
Member
 
Registered: Sep 2002
Posts: 168

Original Poster
Rep: Reputation: 30
I am reading from df command using 1024
 
Old 07-16-2003, 03:47 PM   #5
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
well if you reading it using df then use df -h to get human readable numbers.
 
Old 07-17-2003, 05:10 AM   #6
dvong3
Member
 
Registered: Sep 2002
Posts: 168

Original Poster
Rep: Reputation: 30
Yeah.....solaris system can't read df -h command. I believe some OS have blocks only...like VAX system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTables and PPTPD :S (to block or not to block) thewonka Linux - Networking 0 03-24-2005 07:58 PM
help me block an ip Zac2003 Linux - Security 1 11-03-2004 10:48 PM
How to block? Obie Linux - Security 6 05-15-2004 01:27 AM
how to block an ip porous Linux - Security 2 10-13-2003 03:55 PM
New dude on the block.. fmfnavydoc LinuxQuestions.org Member Intro 2 09-03-2003 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration