So I've made a huge mistake and moved /lib and /opt folders to subfolder. Now almost every command returns "No such file or directory" or "/bin/sh: bad interpreter: No such file or directory". I need to move these files back, but I can't run mv. Can I do it somehow or should I start restoring server from backups?
EDIT:
My provider allowed external access to file system, so I was able to move directories to main directory and everything went back to normal:) Thanks for help.
You might be able to undo the move by something like:
...replacing /subfolder with whatever directory you moved /lib into. If a 64-bit Linux host, try ld-linux-x86-64.so.2 instead.
I haven't fully tested this, because I'm not going to break a system in order to do so!
Step 1: Boot from live-cd...
Step 2: Mount the Hard Disk
Step 3: and move the files back.
Step 4: NEVER do that again.
(if you need specific instructions... just ask)
Don't logout that Putty session ! You probably won't be able to get back into the server.
Can you run busybox ? (it usually lives in /bin so try "/bin/busybox")
Busybox is almost completely self-contained and has build-in versions of most standard Unix commands'. Busybox without any parameters gives you a list of all commands that it can emulate.
You run the commands like "/bin/busybox {command} ".
E.g.: "/bin/busybox mv file1 file2"
If you have it on the system you can probably use it to move everything back to the original locations.
You have a tool called
sln
which is a statically linked ln. You can use this one to symlink the folders to the previous place, and then work from there. So say, if you moved/lib
to/datadrive/lib
and then you broke the system, you could type this to temporarily fix it:Do this for each library path you might have moved.