On 10/16/2015 02:36 AM, Ranjan Maitra wrote:
On Thu, 15 Oct 2015 22:44:20 -0700 Joe Zeff <joe@xxxxxxx> wrote:
On 10/15/2015 09:14 PM, Ranjan Maitra wrote:
No, I would not think so. But if the device is not mounted, would it not write to the mount point, especially because you are doing so as root (so nothing to stop you). This logic seems to make sense to me, and indeed is what happens when I have done it accidentally (without mounting the USB drive).
If the device isn't mounted, there's no mount point for the command to
write to.
Correct. Then where would it write to?
If you write to a /dev/sd* node, you write to the raw device whether
it's mounted or not. If that device happens to be mounted at the time,
then things are going to get very ugly with the mountpoint as the
filesystem associated with the mountpoint won't necessarily know about
what you've done to the underlying device--the filesystem's idea of
what's on the device will be different than what's actually on the
device. Some programs do take care to not permit you to write to a
raw device if it's mounted to keep this from happening.
Mountpoints are just directories. If you write to the mountpoint
_without_ any device being mounted there, then you write into the
mountpoint directory as you would any directory. If you then mount a
device at that spot, the contents of the device will hide the content
existing in that mountpoint directory until you unmount the device.
Then the content you wrote to that directory will reappear.
In general, if the target of some operation is a node in /dev then do
try to ensure it (or any part of it) is _not_ mounted. One of the
easiest ways is to use "mount | grep <device>", e.g.
mount | grep /dev/sdb
If you don't get any output, then you can be relatively sure that no
part of the physical device /dev/sdb is being used as a filesystem.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 -
- -
- "OK, so you're a Ph.D. Just don't TOUCH anything!" -
----------------------------------------------------------------------
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org