1

I have a USB drive that is shared over the network via a SAMBA share. This is because the contents are to be managed by a remote user.

Now, there is a local user with physical access to the USB drive. Once the remote user has finished "managing" the USB drive, he instructs the local user to unmount the drive for safekeeping.

However, since the USB flash drive is currently being shared over SAMBA, the unmount operation cannot succeed without the SAMBA process first releasing the USB drive's file system. This is undesirable because stopping SAMBA would affect the many other users using the other SAMBA shares.

Is there any way to circumvent this problem? Or am I doing it wrong in the first place? Or what if the local user just pulls out the USB drive anyway? Will this cause any problems?

1 Answer 1

1

If your local user is 100% sure that there is no program keeping any file open on this drive anymore it is the sync command to write data from buffers (if any) to the drive. Then you can unplug the USB flash drive. From DESCRIPTION sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The sync program does nothing but exercise the sync system call.

The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the file system corrupted as a result. The sync command ensures everything in memory is written to disk.

Any arguments are ignored, except for a lone --help or --version (*note Common options::).

An exit status of zero indicates success, and a nonzero value indicates failure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .