[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: something about rm



On 16/05/12 12:49 PM, lina wrote:
Hi,

Today I made some mistake,

I mount the remote server my home directory into local laptop.

when I tried to umount it, I justed type the rm -r remote_mount_dir

after I realize it, seems some directoy under ~/home has removed,

one is .ssh, obviously.

others I couldn't tell, like:

-bash-3.2$ firefox
Error: no display specified
-bash-3.2$ xterm
xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

what's the sequence of rm-ing do?  I mean, based on which order it
removes file.
are there some history records those romove process.

Thanks,

Best regards,


What the F! are you doing using rm -r to umount it with rm -r?

The correct sequence of actions if you want to mount point to be deleted after you're done with it is:

umount ~/<mount_point>
rmdir <mount_point>

NEVER use rm -r unless you are sure you have files in a directory that you want to remove. rmdir is safer for removing directories. Since you shouldn't have files in a mount point (although nothing stops you from doing so - you just can't see them when the folder is used as a mount point), rmdir is always appropriate.


If I understand your e-mail correctly, you mounted your home directory for your account on a remote machine to ~/home on your laptop. If you rm -r'd that directory, you have lost your home directory on the remote machine.

I trust you have a backup, because most common file systems can't easily recover deleted files. If you don't have a backup, boot the remote machine from system rescue cd and use photorec to try to recover the files onto a USB stick or removable drive.



Reply to: