Skip to contentSkip to conversation

I've done a very bad mistake

DISCUSSION Andreas Otto 6 participants 7 messages Jul 1, 2004 – Jul 2, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I've done as root:

Quoted 1 line
Quoted 1 line

cp some_file /dev/hdb7

/dev/hdb7 is "was :-(" a reiserfs partition.

Question?

I need a tool with partition as input (dev/hdb7) and all not damaged files as output

for me it is very important to get a solution ... help welcome :-)

mfg

aotto

#1 lore raw
Quoted 2 lines · Andreas Otto

I need a tool with partition as input (dev/hdb7) and all not damaged files as output

I haven't tried dd_rescue but maybe you should read /dev/hdb7 with it and skip the beginning, as much from the beginning as the accidentally copied file is.

Then try fsck with some appropriate rebuild switches on the image.

Signature · 1 line
mjt
#2 lore raw
In reply to Andreas Otto
Quoted 4 lines · Andreas Otto

Hi,

I've done as root:

Quoted 1 line
Quoted 1 line

cp some_file /dev/hdb7

I remember that cp ask to *replace* a file, not to "put the source file at the beginning of the target file". Did you really verified that your partition was really modified ? I would be very surprised of this attitude from cp...

In that case,

# rm /dev/hdb7 &&
# mknod /dev/hdb7 b 3 71

should work on a non-devfs system, and

# rm /dev/hdb7 &&
# ln -s ide/host0/bus0/target1/lun0/part7 /dev/hdb7

should work on a devfs system.

--
Mikael.

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Mikael Cluseau
Quoted 2 lines · Andreas Otto

Hi,

Quoted 8 lines
Quoted 2 lines

I've done as root:

Quoted 1 line
Quoted 1 line

cp some_file /dev/hdb7

I remember that cp ask to *replace* a file, not to "put the source file at the beginning of the target file". Did you really verified that your partition was really modified ? I would be very surprised of this attitude from cp...

hm, i was curious about this and i set up a testimage via losetup, so i can use /dev/loop0 as it it were real devices.

when cp'ing to /dev/loop0, i was able to mount /dev/loop0 again with reiserfs, and no files are corrupted (diff). with ext3, i had to fsck loop0, then one entry was taken to lost+found, but no corruptions present as far as diff can tell. all this was done with devfs. so, "cp" really writes *to* the file, it does not replace it, right?

maybe the OP only has to try latest reiserfsck...

just my 2¢,
Christian.
- --
BOFH excuse #112:

The monitor is plugged into the serial port
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA5EWTC/PVm5+NVoYRAg2zAKDlrJxWjxv/8+rFoR1bVpaedEzR1ACaA6yJ aMJfJOfsq3TXpKbONOaiFEs=
=Iqji
-----END PGP SIGNATURE-----

#4 lore raw
In reply to Andreas Otto

afaik, this only overwrites the device node. recreate it, and you should be fine

Quoted 20 lines · Andreas Otto

Hi,

I've done as root:

Quoted 1 line
Quoted 1 line

cp some_file /dev/hdb7

/dev/hdb7 is "was :-(" a reiserfs partition.

Question?

I need a tool with partition as input (dev/hdb7) and all not damaged files as output

for me it is very important to get a solution ... help welcome :-)

mfg

aotto

Signature · 1 line
Redeeman <[email protected]>
#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Redeeman wrote:
| afaik, this only overwrites the device node. recreate it, and you should | be fine

Last I checked, it doesn't. For instance, I often do

# cp file.img /dev/fd0
# cp /dev/fd0 file.img.test
# diff file.img file.img.test

to write a floppy from an image, then verify that the floppy matches the image.

In fact, I think it detects if the destination is a device node and behaves like 'dd' if it is.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQOTeQHgHNmZLgCUhAQI4HA//aqAFXvrN8avrfzc+eNFN1zIX3m7VFDk9 lll+gMpu9k6poet+40DOL3VFwHMaA/sk6e7MdmYQddYAu8Xk+OGXr/UAV70Hz6pF juTdBVBSDuNB3xOyDBvrJ9e1hSTw0KmLaxNUvvKC2IoI24V2vLPijsCT0+4THd5i P3SAmVZY9xGfTGFrt/u82fbfjv8sOYrLVfFVfD3v6M/swEcCqsCVBliJt0zYpLic v48mcRzmEzGNVxubkd8o/F5EzsOoiHqcA2gZoTDTvFmsToT6anoL6lYeNLbkGuOc 5I5YPnX44V7skU/g+5wXRpLIBXi4NrhYJtwqyY44shNIX+b1DVFG/zHWBOBI9KEz ImhoufwjFzErmKhBMZS5oyHrErtQru3fLDBWWDrrrN7x8Tdj1uEqFKEHhGucqjvs ajQ75LqzjmIRewXQw/i+A7q8uB3nReQYTfnLpU0xIql9Xw9Mw+3eB5dnkuuZvOMi opNRPdbEAxwSPGVybMskyVpaZWLO8gQQDUcOQYa2IUnGsL74qbPswdOkKgsHgwnw iZyb5Je59BzsgKp2JdKhsZhS9k36F3lMqrmlX1+jupO7g/Ql2K6lw/rMjgqF2EcM qMoRjy0zhTskQ4jrj9M7Ge5KFBqoEr4yi92etN+SaGtBUDKlIB6Jmta9j50o0XUw rbnYmnz+JFM=
=JVWe
-----END PGP SIGNATURE-----

#6 lore raw

a device file is just a completely normal file.. almost.. i know this because i once did:

cp blah.blablabla /dev/null
and my null was replaced by this.

Quoted 41 lines · David Masover

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Redeeman wrote:
| afaik, this only overwrites the device node. recreate it, and you should | be fine

Last I checked, it doesn't. For instance, I often do

# cp file.img /dev/fd0
# cp /dev/fd0 file.img.test
# diff file.img file.img.test

to write a floppy from an image, then verify that the floppy matches the image.

In fact, I think it detects if the destination is a device node and behaves like 'dd' if it is.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQOTeQHgHNmZLgCUhAQI4HA//aqAFXvrN8avrfzc+eNFN1zIX3m7VFDk9 lll+gMpu9k6poet+40DOL3VFwHMaA/sk6e7MdmYQddYAu8Xk+OGXr/UAV70Hz6pF juTdBVBSDuNB3xOyDBvrJ9e1hSTw0KmLaxNUvvKC2IoI24V2vLPijsCT0+4THd5i P3SAmVZY9xGfTGFrt/u82fbfjv8sOYrLVfFVfD3v6M/swEcCqsCVBliJt0zYpLic v48mcRzmEzGNVxubkd8o/F5EzsOoiHqcA2gZoTDTvFmsToT6anoL6lYeNLbkGuOc 5I5YPnX44V7skU/g+5wXRpLIBXi4NrhYJtwqyY44shNIX+b1DVFG/zHWBOBI9KEz ImhoufwjFzErmKhBMZS5oyHrErtQru3fLDBWWDrrrN7x8Tdj1uEqFKEHhGucqjvs ajQ75LqzjmIRewXQw/i+A7q8uB3nReQYTfnLpU0xIql9Xw9Mw+3eB5dnkuuZvOMi opNRPdbEAxwSPGVybMskyVpaZWLO8gQQDUcOQYa2IUnGsL74qbPswdOkKgsHgwnw iZyb5Je59BzsgKp2JdKhsZhS9k36F3lMqrmlX1+jupO7g/Ql2K6lw/rMjgqF2EcM qMoRjy0zhTskQ4jrj9M7Ge5KFBqoEr4yi92etN+SaGtBUDKlIB6Jmta9j50o0XUw rbnYmnz+JFM=
=JVWe
-----END PGP SIGNATURE-----

Signature · 1 line
Redeeman <[email protected]>