Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Linux flushes the file cache regularily (i.e. seconds), otherwise, you would loose all your new data after a power failure.
Sorry if I made it seem otherwise. Of course the files are syncronized every few seconds (usually about 5).
And yes, fragmentation is related to the filesystem. NTFS is less fragmented than FAT32 (but still more than any common Linux fs. WinFS was supposed to be the FS to end defraging for MS, but it never made the deadline.)
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.
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.
Uhhhh....
No.
When you mount a filesystem, you are telling the OS where it is, what it is, and how to access it. While it is mounted (presuming it can be written), writes will be committed to it at frequent intervals - at most after a few seconds ordinarily.
When you unmount a filesystem, you are telling the OS that it is no longer there and can't be used.
All filesystems have to be mounted by all operating systems (except custom-written embedded ones) before they can be accessed. Commonly the system hard drive partition will be mounted automatically very early in the boot process, but other drives/partitions/devices can be mounted or unmounted manually and pretty much at will - even in Windows.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by Sepero
Sorry if I made it seem otherwise. Of course the files are syncronized every few seconds (usually about 5).
You indeed made it seem otherwise by this statement:
Quote:
Originally Posted by Sepero
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.)
As you agree now the cache is flushed regularily, I believe they both make little sense.
Quote:
And yes, fragmentation is related to the filesystem. NTFS is less fragmented than FAT32 (but still more than any common Linux fs. WinFS was supposed to be the FS to end defraging for MS, but it never made the deadline.)
No, WinFS is/was not a real filesystem but a different way to access existing files, available on an existing file system (NTFS), so it has no effect whatsoever on fragmentation.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
I think the reason mounting is not visible in Windows is that it is all done automatically. A:\ is the mount point for the first floppy drive, and it expects a 3.5" VFAT filysystem. C:\ is the mount point for the first active primary partition on the primary IDE hard drive. Other disk letters in Windows are likewise - but it is all done automatically.
You could take the C:\ drive from one computer, and put it in another one and it will be mounted accordingly.
Also, USB drives in Windows need to be Unmounted Manually - you have to click "Stop the device" or whatever on the taskbar. Presumably, all the drives in Windows are unmounted cleanly when the computer is shutdown.
As already stated, mounting tells the OS what the filesystem is, where it is, where it is to be accessed from, etc.
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.
If you are correct, then what is the point of 'sync' and 'async' used in /etc/fstab?
I thought 'sync' was there to allow you to physically write changes to the mounted device when you issue the command.
And 'async' just writes the changes when you unmout the device.
I don't know the directory of the intermediate store.
Obviously a server would be 'sync' or at least data would be stored every-so-often.
I do believe that if you have 'async' on, and you simply disconnect the mounted device without unmouting, all data will be lost.
Windows actually uses the bios to know what devices are present in the system to mount them. This is why if you remove a floppy drive and remove it from the bios windows will not make a A: drive in my computer. It does this for almost all disks with the exception of usb media or other external drives. removable media such as cd-roms and floppys have a diffrent access driver then does the hard drives in the system. when you put a disk in what happens behind the scens is much like linux. When you put a cdrom in the drive checks for a disk and if it finds one it sends a data packet to the bios telling it that a disk has been inserted this in turn is captured by the os thus it tries known file systems with an attempt to mount. basicly a mount --auto <cdrom drive>. and then the operating system checks for a file called autorun and executes any commands that are written on this file. Floppies are a bit diffrent as the technology for them is more outdated. the operating system assumes there is a disk in the drive at all times and attempts to just read data from it when asked to. AKA the dredad abort retry fail message. Windows XP might handle this a bit diffrently by attempting a mount operation first but im not sure. As for flash drives windows just monitors the usb device for a power event and when it recivies one it attempts to reconize the device and if it comes back with a code it understands it will attempt to mount the device with known file systems. you can setup linux to do the same things with the exception of floppies as linux will put a drive there regardless of bios calls. (again this differs with difrent device handling with various distributions. I belive my udev does not create the /dev/fda devices
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by nx5000
I highly doubt it. You can easily loose file or even worse, put the filesystem in a state where its not accessible anymore. But I won't try it
I've seen it on XP, the usb stick had to be reformated.
We were talking about Linux (or more generally Unix) mounting/unmounting behaviour, not XP which may have its own flaws here.
However, I know what you mean, and indeed loosing a file or the whole filesytem may (but not will always) happen. This is more due to the FAT unreliability that anything else, and will happen only if you don't wait enough for the cache to be flushed.
I have a quick question:
Do you have to unmount a usb flash drive before you pull it out?
I have SuSE 10.0 and when I put the usb flash drive in, it knows that it is there and reads it. But I want to be sure that I am not ruining anything when I just take the flash drive out without issuing any unmount commands.
I've never been able to get the umount command straight when I tried it either. (I've tried it for a special network folder for Open Office).
yes you definitely need to (unless you're using automount etc...) as the sytem will still think it's there, and try to access it if you go to that directory, which it can't and things go bad.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.