Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

dd corrupt /dev/hda to external USB drive: file size error?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
13 posts • Page 1 of 1
Author
Message
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

dd corrupt /dev/hda to external USB drive: file size error?

  • Quote

Post by sog » Sat Jun 17, 2006 3:50 am

as covered in another thread (http://forums.gentoo.org/viewtopic-t-47 ... ight-.html), i've somehow corrupted my main partition (reiserfs) and am currently unable to access the information.

one recommendation has been to dd the entire drive to another storage source straight up or as a .iso file. unfortunately, i'm unable to do so as i receive a "file size limit exceeded error" - but when i do a ulimit -a from within the target partition, i get a "file size: unlimited."

anybody have any ideas whatsoever? i'd hate to lose everything that's on this drive. i don't mind replacing it, but i'd like to get at least some of the materials on it transferred.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
I.C.Wiener
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 115
Joined: Sun Jul 25, 2004 10:00 pm
Location: Furtwangen (Germany)

  • Quote

Post by I.C.Wiener » Sat Jun 17, 2006 4:19 pm

I just assume you are trying something like this
"ddrescue if=/dev/hda > /mnt/usb/broken_disk.img"
Where /mnt/usb is formated with fat32 (to let those windows-n00bs have access to it).

Fat32 doesn't support files larger than 4GB so this will fail if /dev/hda is larger than that.

Possible solutions:
1. You could try to pipe through bzip which will compress the data on the fly (perhaps it can even splitt files?)
2. copy a single partition only instead of the full disk (might fit into a 4GB file?)
3. use a decent fs like ext3 for the usb-drive
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Sun Jun 18, 2006 10:10 pm

ah, i thought it might be something like that, in spite of what the ulimit returned. will have to find a way around this.

will the dd command work with network drives, because that'll be easier than finding another external drive with a real FS ;)
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
troymc
Guru
Guru
Posts: 553
Joined: Wed Mar 22, 2006 8:48 am

  • Quote

Post by troymc » Mon Jun 19, 2006 12:26 am

sog wrote: will the dd command work with network drives, because that'll be easier than finding another external drive with a real FS ;)
Yes it will. You can use a NFS or SAMBA share, or if you don't have anything like that, simply pipe your dd thru ssh like this:

Code: Select all

# dd if=/dev/hda4 | ssh $fileserver "cd /big/filesystem; dd of=hda4.bin"

troymc
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Fri Jun 23, 2006 8:55 pm

crap. i thought i was golden with troymc's instructions, but no joy.

his help was just what i needed (thanks troymc) - i was able to easily pipe the dd output to the other machine via ssh - but during the dd i got bad block reads.

might have to go w/ Nucleus' Kernel for Reiser now.

does anyone happen to know if ddrescue is on the full install disk?

i'm currently booting off a minimal install, which doesn't have ddrescue on it and i can't chroot and therefore can't emerge.

if the full install disk has ddrescue on it i guess i'll try that, as it supposedly tries to read over/around bad blocks, but if not i'll have to go the commercial route.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
I.C.Wiener
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 115
Joined: Sun Jul 25, 2004 10:00 pm
Location: Furtwangen (Germany)

  • Quote

Post by I.C.Wiener » Sat Jun 24, 2006 12:40 am

knoppix should have ddrescue installed. I think at least an rather old version (3.x) had.

I tried dd with an nfs share a few month ago:

dd if=/dev/hda of=/mnt/nfs-share/hda.img <= this did not work!
dd if=/dev/hda > /mnt/nfs-share/hda.img <= this works fine
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Sat Jun 24, 2006 1:49 pm

first download of knoppix just hung, not 40 MB's from completion. trying again.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Sat Jun 24, 2006 5:04 pm

ok, got the knoppix CD down via bittorrent, but it seems as if dd_rescue is considerably less tolerant of piping things through ssh than plain old dd is.

it keeps telling me that i need to specify input and output files, although it does appear to complete the ssh connection because i'm prompted for a password.

so now i'm attempting to mount the drive in question as a samba share, but that too is giving me problems. i do a:

Code: Select all

sudo mount -t smbfs //192.168.2.4/home/sog/sogjr_recovery /mnt/apone -o username=sog,uid=hs_int1023,gid=samba
(have also tried it with ...192.168.2.4//home... - same error)

in Knoppix and it gives me a:

Code: Select all

4359: tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)
SMB connection failed
i guess i could have screwed up the share in samba, but it doesn't seem that complicated. in /etc/samba/smb.conf, i have the following:

Code: Select all

[sogjr_recovery share]
       comment  = backup share
       browseable = yes
       guest ok = yes
       writable = yes
       path = /home/sog/sogjr_recovery
can anybody see anything obvious i'm doing wrong?

p.s. i should also mention that i've done the smbpasswd -a bit, and have both restarted the samba services and box itself - to no avail.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
zhs
n00b
n00b
Posts: 1
Joined: Tue Jun 27, 2006 8:16 pm

samba stuff

  • Quote

Post by zhs » Tue Jun 27, 2006 8:29 pm

I think your problem is in the command that youre using. After the IP address you need to put the name of the share instead of the path. sudo mount -t smbfs //192.168.2.4/sogjr_recovery_share /mnt/apone -o username=sog,uid=hs_int1023,gid=samba
The other thing that i noticed is that you dont have an underscore between "recovery and "share" I'm not sure if it will accept that as a valid share name....
Oh and also, i dont think samba will let you share home directories either.
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Wed Jun 28, 2006 3:17 pm

that was it, zbs - thx so much for the tip.

by correcting the name of the share, i was successfully able to mount the remote samba dir via the command:

Code: Select all

sudo mount -t smbfs //192.168.2.4/sogjr_recovery /mnt/apone -o username=sog,uid=hs_int1023,gid=samba 
that's the good news. the bad news is that i still can't dd_rescue the thing. i *think* what's happening is that we have some sort of permissions problem.

first, i try:

Code: Select all

dd_rescue if=/dev/hda4 of=/mnt/apone/hda4.iso
dd_rescue: (fatal): open "if=/dev/hda4" failed: No such file or directory
and get the error as above. that's weird, i'm thinking, it seems like i can't read the actual partition. so i try :

Code: Select all

fdisk -l /dev/hda
Cannot open /dev/hda
uh-oh, i'm thinking. if, however, i sudo before that, it works fine.

Code: Select all

sudo fdisk -l /dev/hda

Disk /dev/hda: 40.0 GB, 40007761920 bytes
240 heads, 63 sectors/track, 5168 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1258     9510448+   7  HPFS/NTFS
/dev/hda2            1259        1263       37800   83  Linux
/dev/hda3            1264        1330      506520   82  Linux swap / Solaris
/dev/hda4            1331        5168    29015280   83  Linux
so now i'm thinking no problem, i'll just sudo dd_rescue and be good to go. same error as the first time. then i remember that I.C. Wiener had problems with that format, so i try:

Code: Select all

dd_rescue if=/dev/hda4 > /mnt/apone/hda4.iso
bash: /mnt/apone/hda4.iso: Permission denied
this time, it seems to be able to find the input file fine, and is gagging on the output. it can't write, in other words, to the share. how about if i sudo? same deal.

Code: Select all

sudo dd_rescue if=/dev/hda4 > /mnt/apone/hda4.iso
bash: /mnt/apone/hda4.iso: Permission denied
i thought maybe it was a problem of usernames on the actual share itself - so i've added both the 'root' and 'knoppix' usernames to the samba database on the target machine and restarted samba, but that hasn't worked.

any ideas? i feel like i've made progress - now i just need to close the deal.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
phorn
Tux's lil' helper
Tux's lil' helper
Posts: 109
Joined: Sat Jul 01, 2006 3:26 am

  • Quote

Post by phorn » Sat Jul 01, 2006 8:58 am

Hi,

First of all, about the first error (which you would still get in the second case as well):
The dd_rescue syntax is different:
From dd_rescue -h:
USAGE: dd_rescue [options] infile outfile
To use dd_rescue in your case, run:

Code: Select all

dd_rescue /dev/hda4 /mnt/apone/hda4.iso
i.e. without "if=" or "of="

You will also notice that the dd_rescue error gives you a subtle indicator that the command line format is different:
dd_rescue: (fatal): open "if=/dev/hda4" failed: No such file or directory
You see that it is trying to open a file called "if=/dev/hda4", and dies out since there is no directory called "if=".


Now, with regard to the Permission denied problem, this error has to do with the way bash parses the command line.

Bash sees the command "sudo dd_rescue /dev/hda4", and then bash later recognizes the ">" symbol as a pipe character, so interprets the ">" itself.

While dd_rescue is run as root, bash, which creates the pipe output, is running as a non-root user, which does not have permissions to that directory. (You may notice that the error is "bash: /mnt/apone/hda4.iso: Permission denied").

Since bash encounters an error, it does not attempt to run the command, or else you would get the syntax error with dd_rescue.

To resolve this, you have two options.
One is to use a nested bash shell, like:

Code: Select all

sudo bash -c 'dd_rescue if=/dev/hda4 > /mnt/apone/hda4.iso'
This will create another bash shell, this time running as root, which will pipe to the output file.

This is annoying to write, so a better way is to use dd and dd_rescue's internal output file argument (see above).
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Wed Jul 05, 2006 2:44 pm

you rock phorn. i'm an idiot for assuming the dd_rescue syntax was the same, but i appreciate you not saying so ;)

anyhow, this command failed:

Code: Select all

dd_rescue /dev/hda4 /mnt/apone/hda4.iso
with a but with a simple sudo:

Code: Select all

sudo dd_rescue /dev/hda4 /mnt/apone/hda4.iso
the transfer began just fine. that's the good news.

the bad news is that it errored out after 2GB's transferred with a "File size limit exceeded." i've hit that before on a FAT32 filesystem, but the /mnt/apone filesystem is an Ubuntu box - ext3 filesystem. the same filesystem, moreover, that handled an over 20GB file with dd before that errored out due to the bad block problem.

does anyone know if there's some sort of cap on the size file or partition that dd_rescue can recover? because i don't see any problem with the filesystems.
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
sog
Guru
Guru
User avatar
Posts: 356
Joined: Sun Apr 04, 2004 8:18 pm

  • Quote

Post by sog » Wed Jul 05, 2006 2:59 pm

if it helps at all, it's erroring out consistently (2 times so far) at the same point:

Code: Select all

xferd:   2096128.0k
also, no errors had been hit so far - they typically come after 20 GBs, at least when i've used dd.

Code: Select all

errs:     0
------------------------------------------------
(blog) http://www.redmonk.com/sogrady/
Top
Post Reply

13 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic