{"id":281,"date":"2010-01-30T02:14:42","date_gmt":"2010-01-29T18:14:42","guid":{"rendered":"https:\/\/umarzuki.org\/blog\/?p=281"},"modified":"2010-01-30T02:14:42","modified_gmt":"2010-01-29T18:14:42","slug":"dapatkan-semula-fail-yang-terpadam-dengan-photorec","status":"publish","type":"post","link":"https:\/\/umarzuki.org\/blog\/2010\/01\/30\/dapatkan-semula-fail-yang-terpadam-dengan-photorec\/","title":{"rendered":"Dapatkan semula fail yang terpadam dengan photorec"},"content":{"rendered":"<ol>\n<li>Pasang pakej testdisk sebagai root<br \/>\n<code>aptitude install testdisk<\/code><\/li>\n<li>Mount partition yang hendak digunakan sebagai penyimpan hasil carian. Katakan \/dev\/sdb1 dan sistem failnya adalah <a href=\"http:\/\/www.ntfs.com\/\">NTFS<\/a><br \/>\n<code>ntfs-3g \/dev\/sdb1 \/mnt<\/code><\/li>\n<li>Buat direktori untuk simpan hasil carian<br \/>\n<code>mkdir \/mnt\/photorec<\/code><\/p>\n<p>Sekarang semua hasil carian akan disimpan kedalam folder tersebut<\/li>\n<li>Guna photorec untuk mendapatkan semula fail yang terpadam dan jangan lupa memilih \/mnt\/photorec sebagai destinasi simpanan hasil carian<br \/>\n<code>photorec<\/code>\n<\/li>\n<li>Setelah selesai, susun hasil carian mengikut ekstensi fail dengan skrip recovery.py dibawah. Salin dan simpan kod didalam folder \/mnt\/photorec<br \/>\n[code lang=&#8217;python&#8217;]<br \/>\n#!\/usr\/bin\/env python<br \/>\nimport os<br \/>\nimport os.path<br \/>\nimport shutil<br \/>\nimport sys<\/p>\n<p>source = sys.argv[1]<br \/>\ndestination = sys.argv[2]<\/p>\n<p>while not os.path.exists(source):<br \/>\n    source = raw_input(&#8216;Enter a valid source directory\\n&#8217;)<br \/>\nwhile not os.path.exists(destination):<br \/>\n    destination = raw_input(&#8216;Enter a valid destination directory\\n&#8217;)<\/p>\n<p>for root, dirs, files in os.walk(source, topdown=False):<br \/>\n    for file in files:<br \/>\n        extension = os.path.splitext(file)[1][1:].upper()<br \/>\n\tdestinationPath = os.path.join(destination,extension)<\/p>\n<p>\tif not os.path.exists(destinationPath):<br \/>\n            os.mkdir(destinationPath)<br \/>\n\tif os.path.exists(os.path.join(destinationPath,file)):<br \/>\n            print &#8216;WARNING: this file was not copied :&#8217; + os.path.join(root,file)<br \/>\n\telse:<br \/>\n\t    shutil.copy2(os.path.join(root,file), destinationPath)<br \/>\n[\/code]<\/p>\n<p>Buat satu direktori untuk menyimpan fail-fail yang telah disusun mengikut extension dan susun<br \/>\n<code>mkdir \/mnt\/photorec-sorted<br \/>\ncd \/mnt\/photorec<br \/>\npython recovery.py . ..\/photorec-sorted<\/code>\n<\/li>\n<li>Uji fail satu per satu. Bukan semua yang berjaya ditemui adalah dalam keadaan elok.<\/li>\n<\/ol>\n<p>Rujukan: <a href=\"http:\/\/www.cgsecurity.org\/wiki\/After_Using_PhotoRec\">http:\/\/www.cgsecurity.org\/wiki\/After_Using_PhotoRec<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pasang pakej testdisk sebagai root aptitude install testdisk Mount partition yang hendak digunakan sebagai penyimpan hasil carian. Katakan \/dev\/sdb1 dan sistem failnya adalah NTFS ntfs-3g \/dev\/sdb1 \/mnt Buat direktori untuk simpan hasil carian mkdir \/mnt\/photorec Sekarang semua hasil carian akan disimpan kedalam folder tersebut Guna photorec untuk mendapatkan semula fail yang terpadam dan jangan lupa [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,38],"tags":[],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-linux","category-perisian"],"_links":{"self":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":0,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts\/281\/revisions"}],"wp:attachment":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/tags?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}