2

I have recently installed Linux Mint on an old laptop. I wasn't a Linux user before. Using MS Windows, I have developed a bad habit of unplugging the external hard drive without ever safely removing it.

While on Mint, I renamed a bunch of files and moved others to different directories then I unplugged the hard disk without remembering to eject. When I plugged the hard disk back, I found that only changed directory names remained changed. Renamed and moved files were back to their original folder with their unchanged names. The HDD is formatted as NTFS. I use two OS's now and the habits of Windows are proving hard to kick.

Is there a setting I can change to make the external HD 'hot pluggable' as in Windows?

mount output:

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=joe)
/dev/sdb1 on /media/joe/HD-EG5 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
1

You could mount your hot-pluggable file systems sync. The following U+L question gives a few more details: Difference between 'sync' and 'async' mount options.

(Note however a possibly serious drawback highlighted by Gilles in a comment in this SU answer from 2010: Should I unmount a USB drive before unplugging it?; this could be bad, at least on FAT filesystems, and be unbearably slow as well.)

Essentially, writes to a file system mounted sync are actually committed to disk as soon as possible; the writing process will be made to wait until the write is complete before returning. While this doesn't completely simulate the Windows behavior (unplugging a mounted drive will still cause it to be marked dirty, possibly requiring a fsck at remount), it will make it much less likely that an accidental unplug causes data loss.

  • Thanks for your help. I've read the link and unfortunately I know very little about mounting/unmounting drives. I also know very little about the Linux terminal. Mint automatically mounts the drive when I plug it in. I will leave this unanswered in case someone has something else to share. – Joe Apr 30 '15 at 19:58
  • Oh, OK; then one would have to track down the code that automounts your drive and change the parameters to add -o sync. I would have thought this would be the default for external drives... Perhaps you can print the output of mount (the line relevant to your file external drive) and add it to your question? – dhag Apr 30 '15 at 20:02
  • I've added the mount output. THe last line has the harddisk name on it so I think that is what you are looking for. – Joe Apr 30 '15 at 20:14
  • @dhag It isn't the default because it's extremely slow, and it can kill flash media pretty fast. superuser.com/questions/180722/… – Gilles Apr 30 '15 at 22:37
  • Alright. Thanks for your help. I guess the answer is to always safely remove. – Joe May 1 '15 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.