Monday, April 29, 2024
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 4218  / 3 Years ago, tue, november 2, 2021, 3:57:03

I have an Ubuntu Desktop used as a Server.
This morning I accidentally moved all my root to ../



 root@server:/tmp/UPS/up/upsilon# mv /* ../
mv: impossibile spostare "/dev" in "../dev": Dispositivo o risorsa occupata
mv: impossibile spostare "/proc" in "../proc": Dispositivo o risorsa occupata
mv: impossibile spostare "/run" in "../run": Dispositivo o risorsa occupata
mv: impossibile spostare "/sys" in "../sys": Dispositivo o risorsa occupata
mv: impossibile spostare "/tmp" in una sottodirectory di sé stessa, "../tmp"
root@server:/tmp/UPS/up/upsilon# ls
-bash: /bin/ls: No such file or directory


I was connected remotely in ssh. Now, I can't access anymore. I can't also view Webmin.



So, now I can't restart system correct? And I must physically access to the system console and type this command:



../bin/mv ../{bin,boot,etc,home,media,mnt,opt,root,sbin,selinux,usr,var,vmlinuz*}


right?



Where did my root directory go and how can I get it back? Will the above command work?


More From » data-recovery

 Answers
0

You haven't moved the root directory (you can't), you've just moved nearly everything in it to the parent directory of whatever path you were on.



To complicate things, you've also moved mv so that won't work as expected. The following should work (as long as you haven't rebooted since asking this!) if you're still in the same directory you were when you fired your last mv off.



../bin/mv ../{bin,boot,etc,home,media,mnt,opt,root,sbin,selinux,usr,var,vmlinuz*} /


If you don't have any of those, just omit them from the command.



And if you don't have access (you won't be able to do a fresh login while things are in this state) you'll have to mount the filesystem externally (through something like LiveCD and mount the filesystem and then move the files into the right place. Braiam's answer should help with this part.


[#29969] Wednesday, November 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whipstder

Total Points: 189
Total Questions: 110
Total Answers: 99

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
whipstder questions
Wed, Nov 9, 22, 09:45, 2 Years ago
Tue, Sep 14, 21, 10:54, 3 Years ago
Sun, May 28, 23, 03:52, 1 Year ago
Sat, Jul 17, 21, 07:10, 3 Years ago
;