{"id":1827,"date":"2004-11-13T23:11:05","date_gmt":"2004-11-14T04:11:05","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=1827"},"modified":"2004-11-13T23:11:05","modified_gmt":"2004-11-14T04:11:05","slug":"cf-card-undelete-for-linux","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2004\/11\/13\/cf-card-undelete-for-linux\/","title":{"rendered":"CF Card Undelete for Linux"},"content":{"rendered":"<p>I hope you never need this. But this worked for me.<\/p>\n<p>I accidentally deleted a bunch of files from the CF card that was in my card reader. I recovered them all perfectly.<\/p>\n<p>First, before you do anything else, <strong>unmount the card&#8217;s file system<\/strong>. This will stop any additional changes being made to the card.<\/p>\n<p>You&#8217;ll need to know:<\/p>\n<ol>\n<li>the device name of the card&#8217;s file system. It could be something as simple as <code>\/dev\/sda1<\/code>, or it could be something complex, like <code>\/dev\/scsi\/host1\/bus0\/target0\/lun0\/part1<\/code> (as it is with me).<\/li>\n<li>the names of the files you accidentally deleted. For example, if you deleted <code>dsc_1017.jpg<\/code> and <code>dsc_1018.jpg<\/code> in the <code>dcim\/100ncd70<\/code> directory, you&#8217;ll specify these as <code>\/dcim\/100ncd70\/dsc_1017.jpg<\/code> and <code>\/dcim\/100ncd70\/dsc_1018.jpg<\/code>.<\/li>\n<\/ol>\n<p>First, check that the files can be undeleted:<\/p>\n<p><code># fsck.vfat -u \/dcim\/100ncd70\/dsc_1017.jpg -u \/dcim\/100ncd70\/dsc_1018.jpg \/dev\/scsi\/host1\/bus0\/target0\/lun0\/part1<\/code><\/p>\n<p>If you get the message <code>Warning: did not undelete file ...<\/code>, that&#8217;s a file that has been overwritten, perhaps in your camera. It&#8217;s gone; only the name remains. You won&#8217;t get it back.<\/p>\n<p>Then, you can actually restore the files:<\/p>\n<p><code># fsck.vfat -r -u \/dcim\/100ncd70\/dsc_1017.jpg -u \/dcim\/100ncd70\/dsc_1018.jpg \/dev\/scsi\/host1\/bus0\/target0\/lun0\/part1<\/code><\/p>\n<p>If all goes well, your files will be back. Makes backups, and don&#8217;t do it again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I hope you never need this. But this worked for me. I accidentally deleted a bunch of files from the CF card that was in my card reader. I recovered them all perfectly. First, before you do anything else, unmount the card&#8217;s file system. This will stop any additional changes being made to the card. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[1786,270,1863,1862],"class_list":["post-1827","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-cf","tag-linux","tag-undelete","tag-utility"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-tt","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/1827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=1827"}],"version-history":[{"count":0,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/1827\/revisions"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=1827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=1827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=1827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}