Can filesystems be created only on block devices, but not on character devices?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Can filesystems be created only on block devices, but not on character devices?



Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)?



My guess is yes, not very surely based on the followings:




  • There is a diagram for Linux, from Operating System Concepts:



    enter image description here



  • It seems that in Understanding the Linux Kernel, the IO operations on regular files and on block device files are largely implemented similarly to each other above device drivers, compared to IO operations on character device files.


Thanks.



I seem to remember there are filesystems not built upon physical devices, such as /proc. But I am not thinking about them, or just think of them as being built upon RAM, which is a block device, isn't it?










share|improve this question























  • Are you after a conceptual answer, or the answer based on the Linux implementation?
    – Stephen Kitt
    Sep 25 at 16:43










  • Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
    – Tim
    Sep 25 at 16:44







  • 1




    This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
    – JdeBP
    Sep 25 at 16:45














up vote
0
down vote

favorite












Can filesystems be created only on block devices, but not on character devices?



Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)?



My guess is yes, not very surely based on the followings:




  • There is a diagram for Linux, from Operating System Concepts:



    enter image description here



  • It seems that in Understanding the Linux Kernel, the IO operations on regular files and on block device files are largely implemented similarly to each other above device drivers, compared to IO operations on character device files.


Thanks.



I seem to remember there are filesystems not built upon physical devices, such as /proc. But I am not thinking about them, or just think of them as being built upon RAM, which is a block device, isn't it?










share|improve this question























  • Are you after a conceptual answer, or the answer based on the Linux implementation?
    – Stephen Kitt
    Sep 25 at 16:43










  • Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
    – Tim
    Sep 25 at 16:44







  • 1




    This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
    – JdeBP
    Sep 25 at 16:45












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Can filesystems be created only on block devices, but not on character devices?



Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)?



My guess is yes, not very surely based on the followings:




  • There is a diagram for Linux, from Operating System Concepts:



    enter image description here



  • It seems that in Understanding the Linux Kernel, the IO operations on regular files and on block device files are largely implemented similarly to each other above device drivers, compared to IO operations on character device files.


Thanks.



I seem to remember there are filesystems not built upon physical devices, such as /proc. But I am not thinking about them, or just think of them as being built upon RAM, which is a block device, isn't it?










share|improve this question















Can filesystems be created only on block devices, but not on character devices?



Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)?



My guess is yes, not very surely based on the followings:




  • There is a diagram for Linux, from Operating System Concepts:



    enter image description here



  • It seems that in Understanding the Linux Kernel, the IO operations on regular files and on block device files are largely implemented similarly to each other above device drivers, compared to IO operations on character device files.


Thanks.



I seem to remember there are filesystems not built upon physical devices, such as /proc. But I am not thinking about them, or just think of them as being built upon RAM, which is a block device, isn't it?







filesystems devices block-device character-device






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 25 at 16:46

























asked Sep 25 at 16:37









Tim

23.8k67232417




23.8k67232417











  • Are you after a conceptual answer, or the answer based on the Linux implementation?
    – Stephen Kitt
    Sep 25 at 16:43










  • Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
    – Tim
    Sep 25 at 16:44







  • 1




    This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
    – JdeBP
    Sep 25 at 16:45
















  • Are you after a conceptual answer, or the answer based on the Linux implementation?
    – Stephen Kitt
    Sep 25 at 16:43










  • Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
    – Tim
    Sep 25 at 16:44







  • 1




    This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
    – JdeBP
    Sep 25 at 16:45















Are you after a conceptual answer, or the answer based on the Linux implementation?
– Stephen Kitt
Sep 25 at 16:43




Are you after a conceptual answer, or the answer based on the Linux implementation?
– Stephen Kitt
Sep 25 at 16:43












Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
– Tim
Sep 25 at 16:44





Thanks for asking. Actually both. If not possible, either is fine. I prefer Linux for more practical reason. But I like to be clear at concept level in the first place.
– Tim
Sep 25 at 16:44





1




1




This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
– JdeBP
Sep 25 at 16:45




This question rather presumes the falsehood that all Unix and Linux operating systems have block devices. unix.stackexchange.com/questions/89887 unix.stackexchange.com/questions/259193
– JdeBP
Sep 25 at 16:45










1 Answer
1






active

oldest

votes

















up vote
1
down vote













File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that don't align data on block boundaries, but they still use the underlying buffer cache that works on block devices. Some Unix systems present character devices to access the disk without using the buffer cache, on Linux open with the O_DIRECT flag is used for this.



You can use a file as a block device, see losetup.



A file system is not a block device.






share|improve this answer




















  • Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
    – Tim
    2 hours ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471376%2fcan-filesystems-be-created-only-on-block-devices-but-not-on-character-devices%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that don't align data on block boundaries, but they still use the underlying buffer cache that works on block devices. Some Unix systems present character devices to access the disk without using the buffer cache, on Linux open with the O_DIRECT flag is used for this.



You can use a file as a block device, see losetup.



A file system is not a block device.






share|improve this answer




















  • Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
    – Tim
    2 hours ago














up vote
1
down vote













File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that don't align data on block boundaries, but they still use the underlying buffer cache that works on block devices. Some Unix systems present character devices to access the disk without using the buffer cache, on Linux open with the O_DIRECT flag is used for this.



You can use a file as a block device, see losetup.



A file system is not a block device.






share|improve this answer




















  • Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
    – Tim
    2 hours ago












up vote
1
down vote










up vote
1
down vote









File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that don't align data on block boundaries, but they still use the underlying buffer cache that works on block devices. Some Unix systems present character devices to access the disk without using the buffer cache, on Linux open with the O_DIRECT flag is used for this.



You can use a file as a block device, see losetup.



A file system is not a block device.






share|improve this answer












File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that don't align data on block boundaries, but they still use the underlying buffer cache that works on block devices. Some Unix systems present character devices to access the disk without using the buffer cache, on Linux open with the O_DIRECT flag is used for this.



You can use a file as a block device, see losetup.



A file system is not a block device.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 25 at 17:14









RalfFriedl

4,2481725




4,2481725











  • Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
    – Tim
    2 hours ago
















  • Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
    – Tim
    2 hours ago















Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
– Tim
2 hours ago




Thanks. "they are used as an interface to the kernel or access files across the network or are implemented in user space". Can you give examples for the three cases?
– Tim
2 hours ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471376%2fcan-filesystems-be-created-only-on-block-devices-but-not-on-character-devices%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?