Root Dir Deleted

I delete by mistake the root dir, how i can recover.


By normal means, ie. “rm” or “rmdir” you can’t remove the root directory, so you have done
something rather severe. The recovery procedure goes something like this.

  1. Boot using some other media, eg. a floppy.
  2. dinit hard drive
  3. Find and relink directories that were in the root. Typically /usr and /home are the
    most productive ones.
  4. At this point it is probably best to copy your files off to another media, and reinstall.
    If somehow you got everything back, you run chkfsys which fixes the bitmap.

Under QNX 4 there were some utilities, spatch and relink_directory that you could use.
Since the file systems are the same, it is still possible to use QNX 4 to do this on a
QNX 6 disk, if you happen to own QNX 4. I don’t know remember what the
equivalent utilities are for QNX 6. There was a “recover” disk image floating
around a few years ago. If you are desperate, send me an email and I
will try to hunt it up.

Do you mean the system root directory as / or the root user home directory like /root ?

I deleted the root user home directory like /root

Well first of all, don’t do any writing on the disk until you have this resolved.
It would be a good idea to do an image backup if that is possible.

Next, you will have to either use the QNX 4 relink_dir utility, or search around and
find the equivalent QNX 6 utility. Remember, don’t copy anything to this disk.
Once you have relinked /root, running chkfsys should fix any remaining disk

I guess I would just like to add, it is not usually possible to delete /root unless /root is empty,
in which case there is almost no problem at all, just “mkdir /root”. The only way I know to get rid of a /root that is not empty would be “zap /root”. Is that what you did?