accidentally moved entire linux root "/ " file system to another directory
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
accidentally moved entire linux root "/ " file system to another directory
Hi,
I am running fedora core 6 and was logged in as root. I was in my test log directory /log/test_log when I accidentally issued the following command "mv /log/test_log/5.0.0 /* /log/test_log/6.0.0" Please note that I mistakenly had a space between 5.0.0 and forward slash. It moved the entire root file system / to /log/test_log/6.0.0 directory. Is there way I can restore this back. Please help!!!!
Sure, move it back. However since now most of your OS will not work you will probably need to boot off a livecd, mount the relevant fs(s) to any arbitrary mount point and move the stuff from there.
Sure, move it back. However since now most of your OS will not work you will probably need to boot off a livecd, mount the relevant fs(s) to any arbitrary mount point and move the stuff from there.
While booting from livecd is definitely an option there is another one:
Yes, but unless you get /boot back, you will not be able to boot into your main OS. You will have to boot the Live CD, mount your root filesystem, and move the files back.
For me most confusing is a pair of commands 'mv' and 'rm' - the former is a shorthand of 'move' the latter 'remove'. This way I accidentally removed some files.
Yes, but unless you get /boot back, you will not be able to boot into your main OS. You will have to boot the Live CD, mount your root filesystem, and move the files back.
After executing command I wrote, /lib and /bin directories will be in place, i.e commands like mv, cp, rm, etc will work in the sane way. From this point one obviously have to move back all the parts of the system where they belongs, and in case Lilo used run /sbin/lilo too
It might also be a good time to point out that FC6 has not been updated in yrs (current is F12 or 13?), so it's probably wide open to exploits etc.
Why not take this opportunity to get a current OS?
Hi,
I am running fedora core 6 and was logged in as root. I was in my test log directory /log/test_log when I accidentally issued the following command "mv /log/test_log/5.0.0 /* /log/test_log/6.0.0" Please note that I mistakenly had a space between 5.0.0 and forward slash. It moved the entire root file system / to /log/test_log/6.0.0 directory. Is there way I can restore this back. Please help!!!!
And you've now learned a lesson. Always be extremely careful what you do as root, the rm and mv commands cam make your system completely unusable.
After this command you'll get your /lib and /bin directories back and will be able in the sane way move the rest to it's correct place.
An excellent idea!
I've had the same problem, but I was not signed in as root, so the files got copied, but the subsequent delete couldn't take place because I didn't have the authority.
mv is copy-then-delete. It is really best to copy, then check, and only then do deletes. But mv is so much easier, isn't it?
For the job that the OP was doing, I would have used a file manager such as mc (midnight commander). The risks are much less!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.