Solved

what is the effect of rm comand in network mounted devices ?

Posted on 2010-09-13
8
488 Views
Last Modified: 2012-08-13
HI,

I think that I make a mistake by taping remove command instead of umount command in mounted devices in my pc, I mounted these devices from a pc in my network into my pc:

these mounted devices were created ( in root mode) in /media and contains :
   /media/NASpc/fold_1
   /media/NASpc/fold_2
    /media/NASpc/fold_3
    /media/NASpc/backup_data

and
 /media/NASpc/datatools      create in my home : /home/me/NAS/datatools (in user mode to create this directory)

 
And after that I added on the etc/fstab this lines:

//11.1.8.xxx/fold_1 /media/NASpc/fold_1 cifs username=rnd,password=rnd,default  0 0
//11.1.8.xxx/fold_2 /media/NASpc/fold_2 cifs username=rnd,password=rnd,default  0 0
//11.1.8.xxx/fold_3/media/NASpc/fold_3 cifs username=rnd,password=rnd,default  0 0
//11.1.8.xxx/fold_4 /media/NASpc/backup_data  cifs username=rnd,password=rnd,default  0 0

11.1.8.201:/nas/NASpc-00002/datatools /home/me/NAS/datatools nfs rw,defaults,users,exec 0 0


After rebooting I found with Konqueror in storage media directory all that:

Remote Share (//11.1.8.XXX/fold_1)   Mounted Samba (Microsoft Network) Share
Remote Share (//11.1.8.XXX/fold_2)   Mounted Samba (Microsoft Network) Share
Remote Share (//11.1.8.XXX/fold_3)   Mounted Samba (Microsoft Network) Share
Remote Share (//11.1.8.XXX/backup_data)   Mounted Samba (Microsoft Network) Share
Remote Share (11.1.8.XXX:nas/NASpc-00002/datatools)   Mounted NFS Share

So by knowing that will  this command delete some data :

'rm -R NASpc/'  

Hope there is no danger.

I just did immediatly a ctrl + c to stop this command  and I verify that mounted devices are still presents (I use for that an explorer from a windows pc and connect me to the pc having this ip address 11.1.8.xxx that contains all I mounted)   but I don't know if some datas of these devices are loss if yes how restore these datas?

Thank you




0
Comment
Question by:Develprog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 13

Expert Comment

by:WizRd-Linux
ID: 33668226
If you have write access it starts deleting files exactly as it would with a local disk.  If you don't have write access it should have complained about not being able to delete files.

If you have lost data get out your backups and start restoring, alternatively you will need to find a "recovery" program that doesn't cost the earth to recover deleted files using the machine that has the physical disk
0
 

Author Comment

by:Develprog
ID: 33668290

I was root but in my pc and when I make this command this says me nothing like acces denied. I stopped the command after 4-5 seconds I think. Will be some loss of datas because there is more than 100 GB I think with all devices , is there a waiting time like in windows system to evaluate all amoung of datas ?

If I must recovery how must I do from my pc ? is there Recycle or Trash in my local pc ?

Thank you
0
 

Author Comment

by:Develprog
ID: 33668334

It seems that datas are presents. Is rm command first evaluating the amoung of data to delete before beginning to delete , how deleting is done ?

Thank you
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 13

Expert Comment

by:WizRd-Linux
ID: 33668402
I honestly do not know for sure without starting to look at the source code for rm.. It should call unlink() to remove files.

Hopefully another expert can chip in and advise you of the inner workings of rm,  the alternative could just be the delay because it was a network share and not local.

On a side note you should consider aliasing rm to rm -i especially for your root account, you can always negate the alias with \rm if you are 100% sure you want to delete the file or directory.
0
 

Author Comment

by:Develprog
ID: 33668506

>>It should call unlink() to remove files.
what is unlike() like function ?

I thougt that first is big size files or directories deleted i don't know ?
 
There is too many datas, I check that the most important directories are presents :)

rsync is a tool for recover loss data is'nt it  ?

0
 
LVL 13

Accepted Solution

by:
WizRd-Linux earned 250 total points
ID: 33668613
unlink() is a call to the filesystem driver

Big files and directories first, again I'm not 100% sure how rm actually works without starting to look at the source code.

rsync will allow you to compare files on different hosts and "mirror" the data for lack of better words.

http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html

The above link is how to recover delete files, in short you can't.
0
 
LVL 3

Assisted Solution

by:berniep
berniep earned 250 total points
ID: 33677685
It's highly likely that your rm -R command started removing files immediately, & so if it ran for 4-5 seconds, you will definitely have some data loss.
As well as the alias rm='rm -i' already mentioned, which prompts you for confirmation on every file, which some systems like Red Hat have set by default, you could also use the -v verbose flag to get a listing of files deleted (alias rm='rm -iv').  Of course it's a bit late after the event!

You could run 'rm -ivR NASpc/' again, which will show you which directory your linux system started processing first.  With the -i flag it won't actually do the delete, it'll just prompt you for confirmation on the first file it processes, then use Ctrl-C to abort.  It's quite likely that your system will do the delete in the same order each time.

Then, if you have sufficient disk space somewhere, you could restore that entire folder to a separate area, & use diff to compare the 2.  On linux, a diff on directories shows the differences on file listings, which is handy.

Hope that helps.
0
 

Author Comment

by:Develprog
ID: 33690392

Hi,

Now I see better thank you with this command : 'rm -ivR NASpc/ I see that deleting goes into a directory that I had a backup this directory contained 957 Mo of data and command deleted only 250 Mo of datas. Meaning that other directories are not deleted. Nice to know for the futur.
 

thank you

 
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
A look at what happened in the Verizon cloud breach.
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question