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 01-04-2016, 11:40 AM   #1
Joy Stick
Member
 
Registered: Dec 2015
Distribution: RHEL 4.7
Posts: 61

Rep: Reputation: Disabled
Character device Vs Block device


Dear all,

PHP Code:
HOST   Windows 7 ultimate
GUEST  
RHEL
WORK STATION 
VMWARE VERSION 11 
I added 20gb space to linux machine from d:\ -->(host)

Raw partitions are unformatted disk partitions; -because( ntfs cannot recongnized by ext3)

I read Raw devices are character devices.
Terminals operate in character mode.

PHP Code:
# fdisk -l | grep ^Disk

Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sda: 86.9 GB, 86973087744 bytes
Disk /dev/sdb: 21.4 GB, 21474836480 bytes 
The first entry in the permission field indicates either b--> block, or c--> character

PHP Code:
# ls -l /dev/sda /dev/sdb
brw-rw----  1 root disk 8,  0 Jan  2 19:05 /dev/sda
brw
-rw----  1 root disk 816 Jan  2 19:05 /dev/sdb 
/dev/sdb - This is a raw partition

Then why Linux shows /dev/sdb as 'BLOCK DEVICE'
It must start with c (character device)

Thanks in advance.

Simple explantion wolud be better to get better idea.
From my previous post i got very big explantions.
For me it was NOT easy to understand.
 
Old 01-04-2016, 12:02 PM   #2
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.0 at present.
Posts: 1,168

Rep: Reputation: 201Reputation: 201Reputation: 201
A Character device is a terminal, VDU, keyboard, serial connection as data is transferred one character at a time. There are various handshake signals to inform the sender that the character has been received, etc. The processor generally handles all the transfer handshaking.

A Block device; hard disk (includes pendrives), tape drive, CD/DVDs reads and writes data as "blocks" of data rather than one character at a time, they also tend to do this without use of the processor which is only used to initiate the transfer by DMA (Direct Memory Access) The protocol for block transfer needs to know where the data starts and it's length which means there is a much lower processor overhead.

My

Play Bonny!

 
1 members found this post helpful.
Old 01-04-2016, 12:02 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,961

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by Joy Stick View Post
I read Raw devices are character devices.
That is simply wrong. Disks are block devices. They are addressed and accessed in blocks.

What problem are you actually having.
 
Old 01-04-2016, 01:43 PM   #4
Joy Stick
Member
 
Registered: Dec 2015
Distribution: RHEL 4.7
Posts: 61

Original Poster
Rep: Reputation: Disabled
Originally Posted by Joy Stick

I read Raw devices are character devices.
Quote:
- That is simply wrong. Disks are block devices. They are addressed and accessed in blocks.

Raw devices are character devices (i found via Google)

REF_LINKS:

Unformatted disk partitions are called 'RAW DEVICES'
All unpartitioned devices are Raw devices.

Quote:
/dev/sdb - This is a raw partition
Then why Linux shows /dev/sdb as 'BLOCK DEVICE'

PHP Code:
# ls -l /dev/sda /dev/sdb 
brw-rw----  1 root disk 8,  0 Jan  2 19:05 /dev/sda 
brw
-rw----  1 root disk 816 Jan  2 19:05 /dev/sdb 
Thanks
 
Old 01-04-2016, 01:55 PM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by Joy Stick View Post
Raw partitions are unformatted disk partitions; -because( ntfs cannot recongnized by ext3)
No, that has nothing to do with it. It's unformatted because VMWare doesn't format the "disk" for you, that's up to the VM. The filesystem used on the host is irrelevant, the guest never sees the host's filesystem, that's the point of virtualization.

A disk that contains an unsupported filesystem will look VERY different from one that is not partitioned/formatted at all. You're looking at the output for an unformatted disk, not an unsupported filesystem.

You have an unpartitioned, unformatted disk (block device), not a "raw device". Some people might call it "raw" because it's untouched, similar to "raw" meat that hasn't been cooked, but it's not the same thing as the "raw device" being referenced in those links.

Last edited by suicidaleggroll; 01-04-2016 at 02:15 PM. Reason: typo
 
1 members found this post helpful.
Old 01-04-2016, 02:11 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,943

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
A raw device i.e. /dev/raw* is not the same thing as /dev/sdx or an unpartitioned or unallocated space on a hard drive. As you have discovered it is typically used to perform raw I/O on a block device and bypass caching like Oracle

https://en.wikipedia.org/wiki/Raw_device

Last edited by michaelk; 01-04-2016 at 02:42 PM.
 
2 members found this post helpful.
Old 01-04-2016, 04:50 PM   #7
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
regardless of a drive being formatted or unformatted has nothing to do with its device type.

The link that michaelk posted shows a very good example of what a raw device is. Its basiclly a device that is exposed to the user without much OS implementation.

A extremely simple explanation is below, as you asked for.

These first two are setup and managed by the Operating System.
Character device - device communicates via character exchange.
Block Device - Device communicates via blocks of data.

Raw device - Device is not managed by the OS to communicate. ( gives you raw access )
 
1 members found this post helpful.
  


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
linux device drivers : how can i unregister a character device ? zampa Linux - General 5 06-21-2012 06:34 AM
Linux Driver - how to read/write a block or character device in kernel space (procfs) stybi Linux - Kernel 1 01-27-2011 07:26 AM
Difference between using Raw block device with O_DIRECT and Raw Character Device srithi Linux - Newbie 1 08-19-2009 11:52 AM
Difference between Block device and Character device quartslove Fedora 2 11-29-2006 09:50 PM
UL 1.0 GRUB: could not find device for /boot: not found or not a block device cma Linux - General 4 12-12-2005 04:35 AM


All times are GMT -5. The time now is 12:47 PM.

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