I was trying to replace 512 head bytes of a disk image using dd command, but I missed to use conv=notrunc. Now image size changed to 512. The hosting disk had not any write afterward.

Is it possible to retrieve a dd truncated file? What about disk images?

  • 1
    The bits may be somewhere on the filesystem though will require data recovery tools (or $$$ services) to restore, assuming the bits haven't be reused. (How do you do backups?) – thrig May 17 '17 at 21:35
  • Since the start of file is known (the file is already there) and size is also known, (I know previous size, and it can be extracted from partition table of image), there must be a method to wrap around start and end point?! – 2i3r May 17 '17 at 21:41
  • I'm not really loosing the data, but I'm curious to know if there is a method to deal such situations, preferably using linux tools. – 2i3r May 17 '17 at 21:50
  • Filesystems are rather more complicated than having a "start and end point" somewhere. Try unix.stackexchange.com/questions/43834/… for starters? – thrig May 17 '17 at 22:27
  • What type of filesystem is it? ext, xfs, or what? – fpmurphy May 17 '17 at 23:02

Your Answer

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

Browse other questions tagged or ask your own question.