Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   something about rm (http://www.linux-archive.org/debian-user/667532-something-about-rm.html)

lina 05-16-2012 04:49 PM

something about rm
 
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,


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAG9cJm=9JUEyJHQFXzX6etorBnC_J7dzihvbrzW=9n-q=wdpBg@mail.gmail.com">http://lists.debian.org/CAG9cJm=9JUEyJHQFXzX6etorBnC_J7dzihvbrzW=9n-q=wdpBg@mail.gmail.com

elbbit 05-16-2012 05:27 PM

something about rm
 
On 16/05/12 17:49, lina wrote:
> 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,
Whoops...

> one is .ssh, obviously.
So now you can't login using keys.

> -bash-3.2$ firefox
> Error: no display specified
> -bash-3.2$ xterm
> xterm Xt error: Can't open display:
> xterm: DISPLAY is not set
These look more like environment variable problems. Perhaps caused by a
missing .bashrc file.

> what's the sequence of rm-ing do? I mean, based on which order it
> removes file.
As far as I know, files are removed alphabetically. I'm sure someone
will correct me if I'm wrong.

> are there some history records those romove process.
Unless you did a 'rm -v' and saved the output, I believe the record does
not exist.

Hope your luck changes,
elbbit

--
elbbit@gmail.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FB3E38F.1030202@gmail.com">http://lists.debian.org/4FB3E38F.1030202@gmail.com

Gary Dale 05-16-2012 06:48 PM

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.




--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FB3F698.8000902@rogers.com">http://lists.debian.org/4FB3F698.8000902@rogers.com

rjc 05-16-2012 07:31 PM

something about rm
 
On Wed, May 16, 2012 at 07:48:56PM BST, Gary Dale wrote:
> 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.

+1 yes, I know! ;^)

One thing worth adding, put these in your alias file:

alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'

I know it isn't much of a help now but it will save you future grief.

Cheers,
--
rjc


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120516193155.GA28659@linuxstuff.pl">http://lists.debian.org/20120516193155.GA28659@linuxstuff.pl

Tony Baldwin 05-17-2012 12:50 AM

something about rm
 
On Wed, May 16, 2012 at 02:48:56PM -0400, Gary Dale wrote:
> 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>
>


I was kind of thinking the same thing...rm to umount a remote dir?
But, shouldn't it be
fusermount -u <mount_point>
??
This is what I use if mounting remote dirs with sshfs, anyway.

Tony
--
http://www.tonybaldwin.me
all tony, all the time!
3F330C6E

Gary Dale 05-17-2012 03:20 AM

something about rm
 
On 16/05/12 08:50 PM, Tony Baldwin wrote:

On Wed, May 16, 2012 at 02:48:56PM -0400, Gary Dale wrote:

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>



I was kind of thinking the same thing...rm to umount a remote dir?
But, shouldn't it be
fusermount -u<mount_point>
??
This is what I use if mounting remote dirs with sshfs, anyway.

Tony
Excellent point, if he was using sshfs. I found it hard to figure out
exactly what he was doing. :)


I suspect that file recovery is his current priority.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FB46E8F.4040006@rogers.com">http://lists.debian.org/4FB46E8F.4040006@rogers.com

lina 05-17-2012 04:13 AM

something about rm
 
>>
>> I was kind of thinking the same thing...rm to umount a remote dir?
>> But, shouldn't it be
>> fusermount -u<mount_point>
>> ??
>> This is what I use if mounting remote dirs with sshfs, anyway.
>>
>> Tony
>
> Excellent point, if he was using sshfs. I found it hard to figure out
> exactly what he was doing. :)
>
> I suspect that file recovery is his current priority.

Yesterday it's my first time trying the sshfs (I was so positively
"bored", so just try something new I read online, such a
trouble-maker),

I recovered the .ssh, just by regeneration those keys,
and I found our system administrator is a very nice person,
nearly 1 am he helped me imported some other keys regarding different
nodes (sorry I don't understand well).
from his email.
"Your directory almost restored. I’ve regenerated your vnc. All
working fine. Please try agin."

I don't know much about vnc, just googled for a while and read something basic,

anyway, seem this fixed the following problems:
-bash-3.2$ firefox
Error: no display specified
-bash-3.2$ xterm
xterm Xt error: Can't open display:
xterm: DISPLAY is not set

I will put those alias suggested by rjc in my .bashrc file.

It's not so easy to chown of the mounted remote server, it showed me:

drwx------ 1 513 users 4096 May 17 11:52 pineapple

Thanks all.


>gary@dalefamily.org
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject
> of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/4FB46E8F.4040006@rogers.com
>


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAG9cJmn7A2Kzxrw5mB_z_DB3yB_j_wh2DpqtQn34YP7saCbtL Q@mail.gmail.com">http://lists.debian.org/CAG9cJmn7A2Kzxrw5mB_z_DB3yB_j_wh2DpqtQn34YP7saCbtL Q@mail.gmail.com

Panayiotis Karabassis 05-17-2012 07:48 AM

something about rm
 
On 17/05/2012 06:20 πμ, Gary Dale wrote:
> On 16/05/12 08:50 PM, Tony Baldwin wrote:
>> On Wed, May 16, 2012 at 02:48:56PM -0400, Gary Dale wrote:
>>> 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>
>>>
>>
>> I was kind of thinking the same thing...rm to umount a remote dir?
>> But, shouldn't it be
>> fusermount -u<mount_point>
>> ??
>> This is what I use if mounting remote dirs with sshfs, anyway.
>>
>> Tony
> Excellent point, if he was using sshfs. I found it hard to figure out
> exactly what he was doing. :)
>
> I suspect that file recovery is his current priority.
>
>
It's a "she". :-)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FB4AD3A.9040805@gmail.com">http://lists.debian.org/4FB4AD3A.9040805@gmail.com

Gary Dale 05-17-2012 01:05 PM

something about rm
 
On 17/05/12 03:48 AM, Panayiotis Karabassis wrote:

On 17/05/2012 06:20 πμ, Gary Dale wrote:

On 16/05/12 08:50 PM, Tony Baldwin wrote:

On Wed, May 16, 2012 at 02:48:56PM -0400, Gary Dale wrote:

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>


I was kind of thinking the same thing...rm to umount a remote dir?
But, shouldn't it be
fusermount -u<mount_point>
??
This is what I use if mounting remote dirs with sshfs, anyway.

Tony

Excellent point, if he was using sshfs. I found it hard to figure out
exactly what he was doing. :)

I suspect that file recovery is his current priority.



It's a "she". :-)


"It's"? Shouldn't that be "He's a she"? ;)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FB4F788.1040806@rogers.com">http://lists.debian.org/4FB4F788.1040806@rogers.com

rjc 05-17-2012 04:29 PM

something about rm
 
On Thu, May 17, 2012 at 01:50:12AM BST, Tony Baldwin wrote:
> I was kind of thinking the same thing...rm to umount a remote dir?
> But, shouldn't it be
> fusermount -u <mount_point>
> ??

fusermount is, as the name suggests, for (un)mounting FUSE filesystems.

> This is what I use if mounting remote dirs with sshfs, anyway.

Since SSHFS is a FUSE filesystem in this example that would work -
umount however will deal with any filesystem (as long as there's a
corresponding mount.$FSTYPE helper program of course).

Cheers,
--
rjc


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120517162915.GC14922@linuxstuff.pl">http://lists.debian.org/20120517162915.GC14922@linuxstuff.pl


All times are GMT. The time now is 05:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.