LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   why mounting is necessary (https://www.linuxquestions.org/questions/linux-general-1/why-mounting-is-necessary-524719/)

mamtasahai1 02-01-2007 12:12 PM

why mounting is necessary
 
I just want to know that why mounting is there in linux?

theNbomr 02-01-2007 12:54 PM

Is this a trick question?
It is there so you can access filesystems on partitions. Or not access filesystems on partions. Is there some alternative that I am missing?

--- rod.

acid_kewpie 02-01-2007 12:55 PM

well Linux isn't so insulting as to force you to just have c:, d:, e:, f: etc... you take more care and thought and have a single tree of filesystems seamlessly becoming one well managed entity. you need to specify where things are mounted as there is a flexibility that just doesn't exist within windows.

pixellany 02-01-2007 01:37 PM

Quote:

Originally Posted by mamtasahai1
I just want to know that why mounting is there in linux?

Mounting is required in ALL operating systems. You could have 30 devices connected--the kernel would always have to be told which ones to use---and for what.

Windows "protects" you from having to think about these things, but they are there. Part of the power of Linux is that you are in control of all the details of how things like this get done.

lurko 02-01-2007 01:54 PM

and the windows way is not exactly intuitive. IIRC, it first takes all the primary partitions on all the drives, gives them letters, C, D, E, etc. then it takes all the logical drives/partitions in any extended partitions and gives them letters, F, G, H, etc. So C: is the first primary partition on the primary master. then (assuming no other primary partitions on that drive), D: is the frist primary partition on the primary slave. then E: is the 1st logical drive in an exteneded partition on the primary master, and so on... How does that make any sense? How does that help anyone determine which partition is which? It doesn't!

Unix/Linux requires a bit more work on the user's part, but in the end you get to choose your mountpoints as you see fit, and most likely this will make the whole process of knowing which partition is which a lot more intuitive. But then most people running Windows don't even know what a partition is, so I guess C: D: E: etc and little-to-no control have their place. In "Computer Management" --> "Disk Management" (again IIRC), you can set your various partitions' mountpoints as you see fit, though you are limited to 26 mountpoints (which while obviously limited, is plently for basically every home user of Windows at least. I certainly don't use more than 26 mountpoints in Linux..).

The Godfather 02-01-2007 04:26 PM

I may be wrong, but I thought the main reason for having a mount facility is to allow data to be copied to a temporary store, only written to the mounted device when you unmount. This is useful for a USB storage device, for example, where instead of slowing everything down when executing itermediate saves (as connection to a USB device is comparitvely slower than a HDD), the file is updated when you unmount.

pixellany 02-01-2007 06:25 PM

Mount is required for all devices, not just usb (All--that is--which expect to be seen by the filesystem). And it is--I think-- required mainly just so the system will know what is where.

Normally, you not want the system to wait for unmounting to write data. If, for example, I am putting a lot of files on a pen drive, I do not want it to wait for the "safe eject" or equivalent command to start writing files so I can remove the drive and run to my meeting.

saikee 02-01-2007 06:40 PM

Some Linux distros are now trying to mount everything you have got "automatically".

Slax 5.1.8 mounts over 150 partitions every time I run it. If I want to serach which one of the 150 partitions has Grub I just search "/" of Slax.

Sepero 02-01-2007 07:53 PM

Quote:

Originally Posted by The Godfather
I may be wrong, but I thought the main reason for having a mount facility is to allow data to be copied to a temporary store, only written to the mounted device when you unmount.

This is pretty much the conclusion that I have come to also. Not just for USB, but all writable filesystems.

The order goes like this:
1. mount
2. write files, erase files, modify files (syncing every few seconds)
3. u(n)mount

The benefit is in the Unmount. Because the Unmount is when files are written (syncronized) for the last time and finalized on the drive.

This allows Linux to:
1. Keep files from becoming fragmented.
2. Reduce wasted writes to the drive. (Which is beneficial for any device, but especially flash devices.)

Microsoft tends to write files with less care, which is why their Operating Systems continuously need defragmenting.

Peter_APIIT 02-01-2007 08:15 PM

I want to install a CD to my Mandriva Linux X86_64 computer. How do i do it ?Is it have mount it to my HDD first. Please show some step by step approaches to implement this.

Thanks for your help.

jlliagre 02-01-2007 08:17 PM

Quote:

Originally Posted by Sepero
This is pretty much the conclusion that I have come to also. Not just for USB, but all writable filesystems.

The order goes like this:
1. mount
2. write files, erase files, modify files
3. u(n)mount

The benefit is in the Unmount. Because the Unmount is when files are actually written (syncronized) and finalized on the drive.

Hopefully not.
If so, that would have been a serious bug.
Linux, like all Unixes, do flush the file cache regularily (i.e. seconds), otherwise, you would loose all your new data after a power failure.
Unmounting is also triggering an immediate flush to allow removable media to be unplugged.
Quote:

This allows Linux to:
1. Keep files from becoming fragmented.
2. Reduce wasted writes to the drive. (Which is beneficial for any device, but especially flash devices.)
Fragmentation is unrelated, wasted writes saving do not exist.

Quote:

Microsoft tends to write files with less care, which is why their Operating Systems continuously need defragmenting.
Fragmentation depends on the filesystem, not the O/S.
eg. FAT written by linux get fragmented, while NTFS is no more, no less prone to fragmentation than a typical Linux file systems (ext2/3).

theNbomr 02-01-2007 08:21 PM

Data is written to disk much more frequently than at unmount. If that were true, then where would everything be stored? In memory? What about after a server is up for 2 years, and suddenly loses power?
There is a memory cache, used to optimize access to the disk, and possibly for other purposes. This is the data that is flushed to disk when a filesystem is fsync'd and/or unmounted.
Being able to unmount a disk is one benefit to the Unix way of filesystem management. Another is the ability to mount a partition or external filesystem at any branch in the filesystem tree, and then to change that setup. Another biggie is the ability to support arbitrary filesystem types concurrently. This is one of the big aspects of mounting a filesystem; establishing the relationship between the filesystem directory location, and the driver that performs the work of managing the filesystem.
--- rod.

theNbomr 02-01-2007 08:28 PM

Quote:

Originally Posted by Peter_APIIT
I want to install a CD to my Mandriva Linux X86_64 computer. How do i do it ?Is it have mount it to my HDD first. Please show some step by step approaches to implement this.

Thanks for your help.

man mount.
Look especially at filesystem type ISO9660.

Your CD will probably be something /dev/hdb, /dev/hdc, or /dev/hdd. To get a clue about which it is, try
dmesg | grep hd
Come back here with specific questions once you have done all of the above.
--- rod.

Sepero 02-01-2007 08:31 PM

BTW: My explaination makes Unmounting pretty useless for Read-Only devices, and it actually quite is. There's a few ways to eject CD-ROM's in Linux by pushing the tray button.

I did a search, and all I could come up with is 'autofs' for right now. I'll tell you another way when I get home. I have it setup on my system.

Quakeboy02 02-01-2007 08:34 PM

"BTW: My explaination makes Unmounting pretty useless for Read-Only devices, and it actually quite is."

The OS still needs to read the filesystem type and figure out how to access the data on the disk, regardless of whether it's read or write. Unmounting simply finishes all writes in process, updates inodes and stuff on the disk, and then drops the associations in the OS to the filesystem. It may be true that a desktop will autofs will allow you to eject a CD with the button, but that doesn't mean the filesystem wasn't unmounted.


All times are GMT -5. The time now is 01:39 PM.