blockdev in freebsd

Hello guys,

please, can you tell me the FreeBSD equivalent command of the Linux blockdev command ?

Moreover, is it correct this question, or maybe blockdev is not implemented in FreeBSD because not pertinent ?

Thanks in advance for your time.

Regards.
 
Hello,

I apologize with you but I think that it's not clear for me the real difference between character and block device.

I'm so sorry.

I've understood that tha character devices provide unbuffered, direct access to the hardware device, and I'm agree with FreeBSD modernization of the disk I/O infrastructure.

1 - But what is the difference beetween an hard disk as character device and and an hard disk as block device ?

2 - Again: after an hard disk/USB drive has been plugged into a usb port, the mount process of its filesystem on a FreeBSD machine generate a character or block device ? and if I dothe same on a Linux machine, is its filesystem a character or block device ?
Maybe the stupid idea of the block devices remains implemented on Linux O.S. to realize the strange mechanism that takes name of the autorun and automount ?

Please, excuse me for these questions and confusion. I hope you can assist me.

Thanks in advance for your time.

Regards.
 
As to the difference between character and block devices for the same device: See the wikipedia article that getopt linked to.

Your second question is phrased incorrectly. When a pluggable device is inserted, the kernel recognizes it by its discovery mechanism, and creates a device node for it. What is a device node? The thing that looks like a file and lives in the /dev/ file system. This process is conceptually the same, whether the device is a removable disk (for example USB or hot-pluggable SAS or SATA), or any other device. I can plug USB serial ports and ethernet adapters in, and their devices are dynamically created. For disks, this has nothing to do with mounting them. When the kernel notices that a device has vanished, it destroys the device node; depending on whether the device node is in use or not, the corresponding file entry in the /dev/file system will vanish sooner or later. Again, for disks this has little to do with mounting or unmounting.

Mounting a disk is a separate process. If no automounter is running, it is perfectly possible to plug a disk in, only the device node is created, and it never gets mounted. This is how my server at home is configured: I don't like automounters, and when I plug a USB stick in, nothing happens by itself, until I manually type a mount command. An automounter is nothing special: just a user-space process that watches when device nodes appear, and issues the mount command (in the form of a system call) when a suitable storage device appears.

None of this has anything to do with the question whether the devices created for storage like disks are character or block devices. In the old days, operating systems used to create both, because one type allowed access at arbitrary boundaries, and another type was able to use buffering; today they create only one device, and buffering and access boundaries are negotiable. FreeBSD happens to use character devices, Linux happens to use block devices; today that's a distinction without difference.
 
Back
Top