I was trying to recover some deleted files form my CentOS 7 VM which is live. but I am getting the below error. while entering the command debugfs -w /dev/mapper/centos-root

debugfs 1.42.9 (28-Dec-2013)
/dev/mapper/centos-root: Bad magic number in super-block while opening filesystem

Is there any way to recover the deleted date.


Centos7 might have XFS as root partition instead of ext4, so debugfs won't work. Note that recovery chances are pretty slim if you haven't unmounted filesystem as soon as possible or made a dd(1) image of it to other place.

Your best bet would be to try TestDisk and PhotoRec (recovers more than just photos, though): http://www.cgsecurity.org/wiki/TestDisk

Or you could go the manual route if you remember part of file contents by grepping the disk image (would only work for text file you remember), like so:


Note in any case you'll waste a lot of time, and usually might be able to recover only parts of data or damaged data. If it is more than few files, the effort required might be very uneconomical.

  • You are right I am having a XFS for /boot, is there a way to change XFS to ext4 for /boot. if yes then I can ask a new question. – Mongrel Aug 16 '16 at 2:13
  • @Mongrel safest way is probably to boot to rescue disk, backup files to another partition/disk, refomat as ext4 and restore data. Although there may be easier ways, see serverfault.com/questions/146123/… - note however that doing that doing that (either coversion or backup/restore) will mostly destroy your chances of recovering lost data. – Matija Nalis Aug 16 '16 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.