I was mistakenly copied an iso into my external hard drive!

# dd if=iso.iso of=/dev/sdb oflag=direct bs=1M
^C83+0 records in
82+0 records out
85983232 bytes (86 MB) copied, 2.34214 s, 36.7 MB/s

It's not finished though. Hurriedly pressed ctrl+c to stop it. I could still play videos in my external hard drive but I'm worried. Is it okay? Or not? What should I do?

A clip of fdisk -l output:

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
64 heads, 32 sectors/track, 238475 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x127a3aba

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           0     6047743     3023872   17  Hidden HPFS/NTFS

Sorry for my bad english.

asked 04 Feb '13, 02:51

vecciora's gravatar image

vecciora
212
accept rate: 0%

edited 04 Feb '13, 02:52




dd reported that it wrote 86MB, so there may be file(s) on your drive that got overwritten. If it happened, you will see the problem eventually, as you watch your videos.

If you're worried about using your drive, then back-up your videos, format your drive afresh, and put the videos back on it.

If you want to know the technical stuff of what happened, then read the manual pages about dd, they will explain how it works and thus, exactly what it did.

link

answered 01 Mar '13, 01:06

bogonetic's gravatar image

bogonetic
212
accept rate: 0%

basically, the first 80MB of the partition got clobbered. This would include the main superblock and many of the first inodes.
You're lucky. Because the drive was mounted and in use, a lot of the clobbered data was cached in RAM.

If you haven't rebooted the system or unmounted the filesystem then your best bet is to do like mogonetic suggested and copy as much data as possible to a new drive.

If the drive has been unmounted, and you need to remount it, you'll probably have to run fsck on it using a backup superblock. the 'default' backup superblock is trashed, so run
mkfs -n /dev/sdb1 the -n says don't actually write to the drive, but the output will give you a list of backup superblocks. You want a number higher than 80000. This presumes that you used default options when you originally created the filesystem.
In my case, I got:
# mkfs -n -t ext2 /dev/sdb6
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=

......
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, . . . .
. . . . . . ^^^

so I now go:
fsck -b 98304 /dev/sdb1

HOWEVER: if you really care about the data on the drive, the first thing you should do is make a bit copy of the errant partition. eg: to copy from sdb1 to sdc1,

dd if=/dev/sdb1 of=/dev/sdc1

That way, if something goes wrong, you'll have a spare copy that you can copy back onto sdb1 to try again.

link

answered 02 Mar '13, 17:56

darkonc's gravatar image

darkonc
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×6

Asked: 04 Feb '13, 02:51

Seen: 1,267 times

Last updated: 02 Mar '13, 17:56

powered by OSQA