How to Recover /dev and /boot directory in RedHat Linux 5.3
Red HatThis forum is for the discussion of Red Hat Linux.
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.
How to Recover /dev and /boot directory in RedHat Linux 5.3
Hi
I am using Redhat Linux5.3. Accidentlly I fired rm -rfv / command from putty and deleted /dev and /boot directorty. The file system is ext3. The deleted directory was mounted on /dev/sdb1. Can any one Please help on this how to restore these directories. Thanks in Advance
In addition to that when I am trying to connect through putty it gives me error "Server refused to allocate pty" . I have only one putty connection open which is connected before the delete was done. After deletion of /dev and /boot directory I am not able to connect through putty. Please help me on this.
Last edited by unSpawn; 01-22-2015 at 02:54 AM.
Reason: //Merged posts
Since you have no /dev there are no (pseudo) devices for any process to connect to. Hence starting any process, let alone login process, will fail, epically. of If you have access to any Out of Band connection methods like IPMI, DRAC, ILO or other form of console server (or through your virtualization layer if applicable) try those, attach a Live or installer CD and re-populate /dev. If you have no such way then you're SOL. In that case (contact Data Centre personnel to either set aside this "victim" machine as a copy and) reload from backup. If you have no backups then you're SOL twice but at least now you've learned why you should make them regularly and test restores work.
Below are the list of files which have been deleted from /boot directory. Can you Please tell me which all files should require to reboot the system?
removed `//boot/grub/stage2'
removed `//boot/grub/ufs2_stage1_5'
removed `//boot/grub/menu.lst'
removed `//boot/grub/reiserfs_stage1_5'
removed `//boot/grub/fat_stage1_5'
removed `//boot/grub/grub.conf'
removed `//boot/grub/minix_stage1_5'
removed `//boot/grub/iso9660_stage1_5'
removed `//boot/grub/vstafs_stage1_5'
removed `//boot/grub/stage1'
removed `//boot/grub/xfs_stage1_5'
removed `//boot/grub/jfs_stage1_5'
removed `//boot/grub/splash.xpm.gz'
removed `//boot/grub/device.map'
removed `//boot/grub/e2fs_stage1_5'
removed `//boot/grub/ffs_stage1_5'
removed directory: `//boot/grub'
removed `//boot/symvers-2.6.18-164.el5PAE.gz'
removed `//boot/config-2.6.18-164.el5PAE'
removed `//boot/initrd-2.6.18-164.el5PAE.img'
removed `//boot/.vmlinuz-2.6.18-164.el5PAE.hmac'
removed `//boot/System.map-2.6.18-164.el5PAE'
removed `//boot/vmlinuz-2.6.18-164.el5PAE'
removed directory: `//boot/lost+found'
Can I use initrd-2.6.18-128.el5PAE.img in the place of initrd-2.6.18-164.el5PAE.img (Diffrent version). I have back up of all files but the version is slight change I have 2.6.18-128. Is this work?
Can I use initrd-2.6.18-128.el5PAE.img in the place of initrd-2.6.18-164.el5PAE.img (Diffrent version). I have back up of all files but the version is slight change I have 2.6.18-128. Is this work?
No, it won't work. The kernel modules needed for booting are in that initrd under a directory named for that specific kernel version. A kernel with a different version, however minor, won't find them. You need to restore a matching kernel and initrd.
No. The initrd was built to support your hardware. I'm a bit rusty on CentOS 5, but if it has the /sbin/new-kernel-pkg script you could use that to build a new initrd. You would probably have to play some games to prevent that script from trying to update the GRUB config file -- probably best to save a copy of that file and restore it afterward. Take a look at that script, but the invocation should be something like
I copied the boot folder from another server which has same hardware. Now I have reboot the machine but its not restarting. At the time of starting it showing following error code.
GNU GRUB version 0.97(625k lower / 2047616k upper memory)
[Minimal BASH-like line editing is supporetd. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.]
grub>_
Please help me on this.
Last edited by prakash_kumar; 02-09-2015 at 12:03 AM.
Reason: Mentining error code.
The above grub message means it doesn't have the required modules and grub.conf it needs. So a minimal mode is started.
See you have to reinstall grub2 to the boot folder. I don't use rhel, but do you have a livecd/ rescue cd of RHEL 5.3. If so boot it up and reinstall grub.
You can manually install with command 'grub-install'. Please read about the command thoroughly.
You can copy the kernel and initrd/initramfs image from another system to boot. But if the systems are different then some modules or perhaps necessary scripts won't allow to boot.
So you may have to manually edit initrd/initramfs file appropriately.
Some posts in LQ discussed about mounting all the filesystem appropriately and then chroot to it and install kernel and other packages through a rescue/live cd.
Thanks for reply. Can anyone tell me how to install GRUB mannually in RHEL5.3 ? what will be the exact command? My /boot folder was mounted on /dev/sda1 directory.
Last edited by prakash_kumar; 02-09-2015 at 05:06 AM.
Thanks for reply. Can anyone tell me how to install GRUB mannually in RHEL5.3 ? what will be the exact command? My /boot folder was mounted on /dev/sda1 directory.
You don't. You restore these things from your backups, and if you don't have them, you won't be able to get things working, period. rknichols gave you a command to generate one, but also noted that this WILL NOT WORK between different machines, even if the changes are VERY minor. This hasn't changed. If you had tried to look this up, you'd have found a possible solution on Red Hat's website: https://access.redhat.com/documentat...nstalling.html
...which tells you how to install grub manually. Also, you are using old, unsupported RHEL 5.3...are you PAYING FOR RHEL??? If not, you need to stop where you are, and load CentOS instead. It's almost identical to RHEL, but FREE, and upgrade your server while you're at it. The current version is 7.x.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.