13

I have a server that I can access through SSH. There is no KVM available and there's only one root partition for the whole server. I have deleted some files that I shouldn't have and want to recover them with extundelete ( http://extundelete.sourceforge.net/ ). For this I need to unmount the targeted file system.

Is there a way to unmount the root file system without rebooting? Maybe by doing something similar to what initrd does to boot a system before mounting the root filesystem on some systems?

Thanks

4 Answers 4

16

How about using pivot_root to switch to a temporary, in-memory filesystem root?

See http://www.ivarch.com/blogs/oss/2007/01/resize-a-live-root-fs-a-howto.shtml.

1
  • I wish I'd seen this question when it was first asked, for this is the answer to give. pivot_root is used by many distros during boot to move from an in-memory FS to the disk one. It can certainly be used again to move the other way. Aug 3, 2012 at 23:33
4

You could use dd and netcat to copy the disk/partition somewhere else and do the recovery there.

1
  • That's what I did in the end back then (I should have gone back to answer). But pivot_root would have been the better choice had I known. Nov 26, 2014 at 2:16
3

I would try to get someone to help you with a live rescue CD like the PLD Linux Rescue disk. But only having ssh access, no KVM, no ILO, no backups, etc. is pretty risky.

One other option is to install the free Hot Copy snapshotting utility from R1Soft(hcp): See: http://www.r1soft.com/tools/linux-hot-copy/

It would allow you to take a read-only snapshot of your root partition and mount it to a subdirectory. You could run your undelete/repair utility against the snapshot mount.

3
  • I would love to have someone help me with a rescue CD. But from my past experience with the abysmal level of incompetence of my host, I doubt I could get them to help me... R1soft sounds interesting... Aug 13, 2011 at 19:00
  • Well, the R1Soft Hot Copy will definitely work to give you a read-only snapshot without needing a reboot. What flavor/version of Linux are you running? R1Soft have pre-built modules available for most kernel versions, but your system will need internet access in order to download the appropriate module. This may be your best bet.
    – ewwhite
    Aug 13, 2011 at 20:27
  • Ok, I've been looking at R1Soft Hot Copy and it seems that they store the snapshot in the unused space on my partition, which would run the risk of overwriting the deleted files... I'll ask them some questions... Aug 14, 2011 at 3:19
-3

No, this is not doable on this earth.

4
  • 4
    Nor in the universe.
    – mailq
    Aug 13, 2011 at 14:38
  • 3
    Or, in any other universe. Aug 13, 2011 at 15:01
  • @EightBitTony: Who knows what is possible in other universes ;)
    – user9517
    Aug 13, 2011 at 17:15
  • 4
    Yes it is, see first answer
    – Cookie
    Apr 18, 2018 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .