Timeline for Why do we need to mount on Linux?
Current License: CC BY-SA 3.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 9, 2015 at 9:46 | comment | added | Luaan | @Tonny MSCDEX was exactly one of the examples I was thinking of. There was also others like SCSI drives and such, and of course, network resources (although those are an entirely different beast). Win9x hid those away from users - you could still use MSCDEX, but there was no need anymore. And sure, FAT/NTFS partitions are mounted automatically, but you still have to mount EXT or WBFS manually, for example. And in older Windows, you had to manually mount CD-RWs, for example. It's just that there's a shortcut for FAT/NTFS/Joliet etc. | |
| Jan 8, 2015 at 21:02 | comment | added | Tonny | @Luaan & psusi Psusi has the right of it. But for nearly all intends and purposes the effect for the caller of the Win32 API is basically identical. (For Posix compliance there is even an emulation of mount semantics.) Win9x actually does have the concept of mount because it still runs on top of DOS. FAT support was build in into DOS as a native handler somewhat similar to the way the NT kernel handles it. But CDROM and network filesystems had to be mounted. (Remember MSCDEX for CD. This provided the ISO/RockRidge filesystem handler and mounted it on drive-letter). | |
| Jan 8, 2015 at 18:21 | comment | added | psusi | @Luaan, nope, I'm talking about the NT kernel ( all versions ). You can not ask for anything like a mount, you just open, for example, \Devices\PhysicalDisk0\Parittion1\foo.txt, and that triggers a search for a suitable filesystem if one has not yet been bound to the device. The drive letter concept is implemented at the win32 api level as a symbolic link, such as \DosDevices\C: -> \Devices\Physicaldisk0\Partition1. Assigning the drive letter / creating that symlink is not activating a filesystem anywhere; it just creates a name in the win32 namespace that points to the disk device. | |
| Jan 8, 2015 at 16:22 | comment | added | Luaan | @psusi You couldn't do that on Windows 95, true. But it was present (and well hidden) on MS DOS and Windows NT. Your modern NT-based Windows certainly allows you to mount and unmount partitions at will (even into folders on other partitions, and even into multiple folders at the same time) - it just usually mounts all unknown partitions to drive letters by default. You can also access the device without mounting it by using it's full path (very similar to the unix way), but only if it's not locked - which it of course is if it's currently mounted. | |
| Jan 8, 2015 at 15:25 | comment | added | MSalters | One of the more common reasons to use raw access it to flat-out copy an entire disk to a new disk, partitions and all. This can be useful when upgrading or replacing a failing disk. Typically this is done with dd. | |
| Jan 8, 2015 at 15:20 | comment | added | psusi | @orion, mounting on Windows isn't just done automatically by the shell or something, like on a linux desktop. There really is no concept of mount on Windows. You can't specify a directory where it should be mounted, or mount options or even that it should be mounted. You do like the OP suggested and just try to open the windows equivalent of /dev/sda1/foo.txt, and if there is no filesystem bound to that block device, the kernel asks all loaded filesystem drivers to take it over and try to provide access to that file. | |
| Jan 8, 2015 at 9:04 | comment | added | David Z | @Ehryk (3 comments up) the only preventative measure in a typical Linux system is the filesystem permissions - in other words, you have to use the root account to write to a device file. If you do, you can cat >/dev/sda1 to your heart's content and Linux won't stop you. (Needless to say, doing so would completely corrupt the filesystem.) | |
| Jan 8, 2015 at 8:01 | comment | added | orion | Just to add a bit more, mounting initializes the filesystem and thus also activates an entire layer of automatic handling of input/output operations that is transparent to the user (such as caching files in RAM, queueing the operations, holding the states of open files and so on). This is why you also have to unmount the filesystem correctly to avoid corruption (or at least sync it). Mounting is present on all commonly used platforms, not just linux. If mounting is automatically handled by the desktop environment (KDE or gnome), it's just as hidden as in MS windows. | |
| Jan 8, 2015 at 6:25 | vote | accept | Greeso | ||
| Jan 8, 2015 at 6:24 | history | edited | Ehryk | CC BY-SA 3.0 | Added device file wikipedia links |
| Jan 8, 2015 at 5:37 | history | edited | Ehryk | CC BY-SA 3.0 | added 308 characters in body |
| Jan 8, 2015 at 4:58 | comment | added | Ehryk | And the process of mounting IS what allows you to access the content of the device as a file system; it does whatever magicry is involved with figuring out the file system, loading the kernel module or code that it needs to, and facilitating the creation of that interaction layer. Once that's in place, mount has finished it's job but the file system code remains in place to provide the file system. | |
| Jan 8, 2015 at 4:55 | comment | added | Ehryk | I'm glossing over some details, because I think bad things will happen if you just start writing to whatever data is stored on /dev/sda1, and thus I assume there's some preventative measures or perhaps abstraction that would stop you from overwriting things. But to sum it up, if you knew exactly how and where to write to the disk you could do it manually through /dev/sda1. Note some tools DO interact directly with raw disks, such as swapon/swapoff and dd. | |
| Jan 8, 2015 at 4:50 | comment | added | Greeso | So in other words, you are saying, mounting helps access the content of the device as a regular file system via /dev/sda1. However, if we want to read/write input/output directly, then we can do so via /dev/sda1 which will be transferred to the output? | |
| Jan 8, 2015 at 4:44 | history | edited | Ehryk | CC BY-SA 3.0 | added 557 characters in body |
| Jan 8, 2015 at 4:37 | history | answered | Ehryk | CC BY-SA 3.0 |