Interupted dd Copy

About an hour ago, I tried to backup one of several partition on my notebook to my external disk. I chose dd command to do backup. As far as I know, dd command do the backup bit per bit ā€“ it copy everything from the low level filesystem. When the backup running, I shuted the computer down by pressing the power button. I did it because my Ubuntu became not responsive (may be because high load)….it was amazed me that Linux can hanging like that ā€“ remind me to Windows of course.

After boot, I found a ghost file on my disk. That file supposed to be my backup file, but it didn’t completed yet. I wasn’t able to delete it. See the logs below :

tedy@tedy-laptop:/media/tedy-wd/backup-winc$ ls -ltr
ls: cannot access winc.tar: Input/output error
total 0
-????????? ? ? ? ?                ? winc.tar
tedy@tedy-laptop:/media/tedy-wd/backup-winc$ rm -f winc.tar
rm: cannot remove `winc.tar': Input/output error
tedy@tedy-laptop:/media/tedy-wd/backup-winc$

Then I tried to do fsck on my external disk, but I just realize that fsck cannot be applied on disk that using NTFS partition. Looking good clue on the Internet, I read the article here. Somebody suggested to use ntfsresize to simulate NTFS disk check. And here is the result :

tedy@tedy-laptop:~$ sudo ntfsresize --no-action --force -s 110G /dev/sdb1
ntfsresize v2.0.0
Device name        : /dev/sdb1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 250056704512 bytes (250057 MB)
Current device size: 250056705024 bytes (250057 MB)
New volume size    : 109999993344 bytes (110000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Cluster accounting failed at 879939 (0xd6d43): extra cluster in $Bitmap
Cluster accounting failed at 879940 (0xd6d44): extra cluster in $Bitmap
Cluster accounting failed at 879941 (0xd6d45): extra cluster in $Bitmap
Cluster accounting failed at 879942 (0xd6d46): extra cluster in $Bitmap
Cluster accounting failed at 879943 (0xd6d47): extra cluster in $Bitmap
Cluster accounting failed at 879944 (0xd6d48): extra cluster in $Bitmap
Cluster accounting failed at 879945 (0xd6d49): extra cluster in $Bitmap
Cluster accounting failed at 879946 (0xd6d4a): extra cluster in $Bitmap
Cluster accounting failed at 879947 (0xd6d4b): extra cluster in $Bitmap
Cluster accounting failed at 879948 (0xd6d4c): extra cluster in $Bitmap
Filesystem check failed! Totally 1012766 cluster accounting mismatches.
ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.
tedy@tedy-laptop:~$ 

Unfortunately ntfsresize command gave up and suggest me to perform disk check on the Windows machine. So here is the result when I executed chkdsk on Windows XP :

C:\Documents and Settings\Tedy Tirtawidjaja>chkdsk /f E:
 The type of the file system is NTFS.
Volume label is tedy-wd.

CHKDSK is verifying files (stage 1 of 3)...
Deleting corrupt file record segment 37330.
File verification completed.
Deleting orphan file record segment 37331.
Deleting orphan file record segment 37332.
Deleting orphan file record segment 37333.
Deleting orphan file record segment 37334.
Deleting orphan file record segment 37335.
Deleting orphan file record segment 37336.
Deleting orphan file record segment 37337.
Deleting orphan file record segment 37338.
Deleting orphan file record segment 37339.
Deleting orphan file record segment 37340.
CHKDSK is verifying indexes (stage 2 of 3)...
Deleting an index entry from index $O of file 25.
Deleting an index entry from index $O of file 25.
Deleting index entry winc.tar in index $I30 of file 37329.
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.
Correcting errors in the uppercase file.
CHKDSK discovered free space marked as allocated in the
master file table (MFT) bitmap.
CHKDSK discovered free space marked as allocated in the volume bitmap.
Windows has made corrections to the file system.

244196000 KB total disk space.
211528444 KB in 35171 files.
9676 KB in 1284 indexes.
0 KB in bad sectors.
114780 KB in use by the system.
65536 KB occupied by the log file.
32543100 KB available on disk.

4096 bytes in each allocation unit.
61049000 total allocation units on disk.
8135775 allocation units available on disk.

C:\Documents and Settings\Tedy Tirtawidjaja>

I did disk check twice, once more after I restarting Windows.

C:\Documents and Settings\Tedy Tirtawidjaja>chkdsk /f E:
 The type of the file system is NTFS.
Volume label is tedy-wd.

CHKDSK is verifying files (stage 1 of 3)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 3)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.
Windows has checked the file system and found no problems.

 244196000 KB total disk space.
211528444 KB in 35171 files.
9676 KB in 1284 indexes.
0 KB in bad sectors.
114780 KB in use by the system.
65536 KB occupied by the log file.
32543100 KB available on disk.

4096 bytes in each allocation unit.
61049000 total allocation units on disk.
8135775 allocation units available on disk.

C:\Documents and Settings\Tedy Tirtawidjaja>

As you can see, chkdsk did his job perfectly. I removed back my external disk to Ubuntu and everything back to normal now. No more ghost file in my external disk.

tedy@tedy-laptop:/media/TEMP$ ls -ltr backup-winc/
total 0
tedy@tedy-laptop:/media/TEMP$

Valueable lesson for me : don’t ever to try to interupt dd process again. And learn how to write in English better than this post ;))

2 thoughts on “Interupted dd Copy

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.