You are not logged in.

#1 2007-10-11 09:29:38

quarks
Member
From: Netherlands
Registered: 2007-05-14
Posts: 66

[Dumb mistake] Image file dd'ed to hd partition instead of usb drive

I accidentally dd'ed a liveusb image to a hd partition instead of an usb flash drive with:
sudo dd if=faunos-fortytwo-0.3.2-usb.img of=/dev/sdb

But /dev/sdb is my second hd, the usb was located at /dev/sdc.
My partition list according to parted is now as follows:
                                                           
Model: ATA WDC WD740ADFD-00 (scsi)
Disk /dev/sda: 74.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
1      32.3kB  20.0GB  20.0GB  primary   ext3         boot
2      20.0GB  74.3GB  54.3GB  extended                   
5      20.0GB  72.5GB  52.5GB  logical   ext3             
6      72.5GB  74.3GB  1842MB  logical   linux-swap

Model: ATA HDT722525DLA380 (scsi)
Disk /dev/sdb: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
1      32.3kB  24.7MB  24.6MB  primary  fat16             
2      24.7MB  979MB   954MB   primary  ext3         boot

As you can see /dev/sdb is formatted to different filesystem, however I can still access part of that partition.
df -h lists:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              19G   12G  5.9G  67% /
none                  502M   12K  502M   1% /dev/shm
/dev/sda5              49G   45G  1.2G  98% /home
/dev/sdb5             174G  168G  5.6G  97% /media/media
/dev/sdb6              57G   45G  9.1G  84% /media/temp

Only /dev/sdb6 (/media/temp) is gone, the partition /dev/sdb5 (/media/media) is (luckily) intact for as far as I can tell.
Why is it that 'df' lists this differently and can I recover the filesystem on /dev/sdb like it was before (as seen in df table; was ext3) without any further data loss?

Offline

#2 2007-10-11 10:56:07

retsaw
Member
From: London, UK
Registered: 2005-03-22
Posts: 132

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

It's odd that you can't access sdb6, but can still access sdb5 when sdb5 would be the one that was overwritten assuming it is the first partition on the disk.

gpart can try to guess where partitions should be when you have lost the partition table, and you might be able to recover what is left of sdb5 if you repartition correctly and use e2fsck on it pointing to one of the still intact backup superblocks. I wouldn't count on it working though.  If you don't have backups, try to backup everything you want to keep from sdb5 before shutting down your computer.

Offline

#3 2007-10-11 14:59:23

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

This is just one of several reasons I really dislike the move to treat IDE drives as SCSI drives - when my flash drive, my camera, and my hard drive are all /dev/sd* this is a disaster waiting to happen.  I gave up on the Arch kernel and compiled my own kernel with old-school IDE drivers so I have my /dev/hd* device names back where they belong.


Peter B. Steiger
Cheyenne, WY

Offline

#4 2007-10-11 20:52:51

quarks
Member
From: Netherlands
Registered: 2007-05-14
Posts: 66

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

retsaw wrote:

It's odd that you can't access sdb6, but can still access sdb5 when sdb5 would be the one that was overwritten assuming it is the first partition on the disk.

gpart can try to guess where partitions should be when you have lost the partition table, and you might be able to recover what is left of sdb5 if you repartition correctly and use e2fsck on it pointing to one of the still intact backup superblocks. I wouldn't count on it working though.  If you don't have backups, try to backup everything you want to keep from sdb5 before shutting down your computer.

Thanks, I'll do that after I backup the 170GB. hmm

Offline

#5 2007-10-11 20:53:22

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,155

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

You are aware that SATA drives are named sdx always and almost all new systems have sata drives now  ?

this might help : Arch Wiki on Persistent_block_device_naming

If you don' t feel  like using persisten names , use

HOOKS="base udev ide scsi sata usb filesystems"

in /etc/mkinitcpio.conf and regenerate the initrd.

You don't need to compile your own kernel for this.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#6 2007-10-11 23:47:12

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

Hmmmmm... he said his HD, so I *assumed* (bad idea!) that he still uses IDE like I do.  I can't afford to replace my drives with SATA yet :-(

I also don't like using initrd.  I have enough memory that there is no reason to use a 2-stage boot, I would rather just put it all into one image.  But now that I know about the HOOKS option, I might try that the next time I install a new kernel.


Peter B. Steiger
Cheyenne, WY

Offline

#7 2007-10-12 00:07:55

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

WyoPBS wrote:

Hmmmmm... he said his HD, so I *assumed* (bad idea!) that he still uses IDE like I do.  I can't afford to replace my drives with SATA yet :-(

I also don't like using initrd.  I have enough memory that there is no reason to use a 2-stage boot, I would rather just put it all into one image.  But now that I know about the HOOKS option, I might try that the next time I install a new kernel.

You certainly don't seem to like modernization. ;)

Offline

#8 2007-10-12 03:32:28

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: [Dumb mistake] Image file dd'ed to hd partition instead of usb drive

iBertus wrote:

You certainly don't seem to like modernization. wink

You're just saying that because you're jealous of the superior throughput I get with my 300 baud Hayes Micromodem on my trusty old Apple ][+.

Apple ][ Forever!  (if it wasn't designed by Woz, it ain't an Apple)


Peter B. Steiger
Cheyenne, WY

Offline

Board footer

Powered by FluxBB