Can I use dd to write to a disk at a specific offset?
Can I use dd to write to a disk at a specific offset?
I need a way to change the two media bytes on a disk at offset 15hex and 615hex without disturbing the rest of the disk.
Can I use the dd command to do this?
The problem being that any usb device that has a fat filesystem written to it using mkdosfs sets the media byte as being a hard drive.
Is it really a problem?
Don't know if this would affect the usability.
This directly affects writing a fat file system to USB floppys.
When doing the same task to FD0, the media byte is correct.
So this is a bug and I just need some insight.
Can I use the dd command to do this?
The problem being that any usb device that has a fat filesystem written to it using mkdosfs sets the media byte as being a hard drive.
Is it really a problem?
Don't know if this would affect the usability.
This directly affects writing a fat file system to USB floppys.
When doing the same task to FD0, the media byte is correct.
So this is a bug and I just need some insight.
Use of the dd command
Hi,
What you describe may be a help for a system I was building for a friend, where they wanted XP on a CFide adapter, but XP will not create a swap file on the CF disk.
As an aside - I have a Dane usb drive running on an XP security camera system and it identifies itself to XP as HD, (loaded pics in and out for over 3 years no fails yet) so it is possible to fool XP, but never could duplicate that device.
I want to try what you describe on a Sans or PNY stick, - are you doing a full format or please give description of DD commands.
Also have read (somewhere) that DD will backup Puppy as it is setup on a PC, any commands for that you might know.
Thanks for any ideas and help
Jay
What you describe may be a help for a system I was building for a friend, where they wanted XP on a CFide adapter, but XP will not create a swap file on the CF disk.
As an aside - I have a Dane usb drive running on an XP security camera system and it identifies itself to XP as HD, (loaded pics in and out for over 3 years no fails yet) so it is possible to fool XP, but never could duplicate that device.
I want to try what you describe on a Sans or PNY stick, - are you doing a full format or please give description of DD commands.
Also have read (somewhere) that DD will backup Puppy as it is setup on a PC, any commands for that you might know.
Thanks for any ideas and help
Jay
efiguy,
I tried once to copy one hard drive to another using dd.
I did not know much about how to use it at all.
As a result, I trashed the contents of both hard drives.
What got me into trouble was the fact that there is very limited documentation as to if the source and destination drives should be mounted or not.
On the Puppy menu under Utility, you will find a utility called Pudd.
It goes further in telling you if a drive or partition needs to be mounted or not.
But be prepared to have a backup take a while depending on the size of the hard drive or partition.
I copied a 4 gig partition from one drive to another and let it run overnight.
I remember another user stating a partition/drive he backed up/copied, took 33 hours!
With the ever increasing size of hard drives, a good backup program is needed that does full, or incremental, backups with or without compression.
If you attempt to use the 'dd' command from the command line, I would suggest doing 'man dd' from the command line first to find out its use and options.
Also triple check that you have the mounting right for using it and the source and destination right.
All it takes is getting it wrong to trash your hard drive when you hit return.
I tried once to copy one hard drive to another using dd.
I did not know much about how to use it at all.
As a result, I trashed the contents of both hard drives.
What got me into trouble was the fact that there is very limited documentation as to if the source and destination drives should be mounted or not.
On the Puppy menu under Utility, you will find a utility called Pudd.
It goes further in telling you if a drive or partition needs to be mounted or not.
But be prepared to have a backup take a while depending on the size of the hard drive or partition.
I copied a 4 gig partition from one drive to another and let it run overnight.
I remember another user stating a partition/drive he backed up/copied, took 33 hours!
With the ever increasing size of hard drives, a good backup program is needed that does full, or incremental, backups with or without compression.
If you attempt to use the 'dd' command from the command line, I would suggest doing 'man dd' from the command line first to find out its use and options.
Also triple check that you have the mounting right for using it and the source and destination right.
All it takes is getting it wrong to trash your hard drive when you hit return.
Use of the dd command
Thank you 8-bit,
That was real useful info. I'll experiment with old drives at a later date.
Since jumping into Puppy and using the ext2 file system don't have a good way to clone or have a backup drive. PQI worked for fat32, and I used to run that exclusively even with XP, hated their NTSF5 system.
But decided to make 431 webserver systems all Linux and use Fat32 for the actual html files as it is easier to share within the intranet via usb. (and actually serve files from 8 Gb PNY Fat32 sticks)
Got an off the cuff question, never had Pup running for any length of time, and since server PC has been up for tests about 30 hours, have found the XP zonealarm systems on intranet have been receiving a UDP ping on port 631 from the server IP - something like every 4 hours. There are no shares or network wizards run for Puppy, and am wondering what process is doing this UDP thing.
Please advise where this question should be posted, if it's something unknown or unexpected
Thanks for superb post on DD
Jay
That was real useful info. I'll experiment with old drives at a later date.
Since jumping into Puppy and using the ext2 file system don't have a good way to clone or have a backup drive. PQI worked for fat32, and I used to run that exclusively even with XP, hated their NTSF5 system.
But decided to make 431 webserver systems all Linux and use Fat32 for the actual html files as it is easier to share within the intranet via usb. (and actually serve files from 8 Gb PNY Fat32 sticks)
Got an off the cuff question, never had Pup running for any length of time, and since server PC has been up for tests about 30 hours, have found the XP zonealarm systems on intranet have been receiving a UDP ping on port 631 from the server IP - something like every 4 hours. There are no shares or network wizards run for Puppy, and am wondering what process is doing this UDP thing.
Please advise where this question should be posted, if it's something unknown or unexpected
Thanks for superb post on DD
Jay
- Pizzasgood
- Posts: 6183
- Joined: Wed 04 May 2005, 20:28
- Location: Knoxville, TN, USA
Looks like that's CUPS. Maybe try the suggestion in the final post here:
http://www.linuxquestions.org/questions ... pp-382763/
http://www.linuxquestions.org/questions ... pp-382763/
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]
[img]http://www.browserloadofcoolness.com/sig.png[/img]
efiguy
very simple but works
let me know if that does it for you
@amigo
http://www.linuxquestions.org/linux/ans ... ng_With_DD
its been a few years since I had to low level hex edit a drive to fix The MBR I used the ultimate boot disk cd I don't know if that works on USB drives though
but for the hard drive it did work well
Joe
ping on port 631
very simple but works
Code: Select all
#!/bin/sh
#script name stop_cups
#a quick fix for sever error big_bass
#killall cupsd
/etc/init.d/cups stop
Code: Select all
#!/bin/sh
#script name start_cups
#a quick fix for sever error big_bass
/etc/init.d/cups start
let me know if that does it for you
@amigo
maybe it is this one?There is a really super thread on linuxquestions.org about how to use dd in *many* useful ways, but I can't find it at the moment.
http://www.linuxquestions.org/linux/ans ... ng_With_DD
its been a few years since I had to low level hex edit a drive to fix The MBR I used the ultimate boot disk cd I don't know if that works on USB drives though
but for the hard drive it did work well
Joe
-
- Posts: 66
- Joined: Sun 25 Oct 2009, 14:23
- Location: The only place in tornado ally with no tornadoes
dd hard diskcoping
dd if=/dev/hda1 of=/root/hda1.img && tar -c hda1.img hda1.tar
(not shure about tar shure about dd )
thelaptopkiller
(not shure about tar shure about dd )
thelaptopkiller
Thanks Joe for finding that -that thread is really long, but worth savinf a copy of for future reference.
dd can be used on USB drives the same as builtin drives, and can also be used on loop-mounted partition/disk images, files or even from/to pseudo-devices like /dev/zero, dev/null
Interesting thing about the name -at first I thought it meant direct-to-disk as that is the way you usually use it. But, it's real name is 'copy-and-convert', but since 'cc' is the name of a compiler, they opted to name it 'dd'!
Really useful for loads of jobs -just last week I implemented a way to use it instead of 'file' to discover some file types(since 'file' can be dangerous on unknown objects) a lot faster than running 'file obj |grep ELF' on hundreds of objects.
laptopkiller, there is no point in using tar on a single object. Suing dd will preserve all the perms effectively as nothing gets inetrpreted. dd copies bit-by-bit or block-by-block without 'reading' any filesystem realted metadata.
Joe will remember a tip I passed him not long ago about using dd to replace barry's 'truncate' program -by inserting a NULL character into a file at a given point, the file gets truncated there.
dd can be used on USB drives the same as builtin drives, and can also be used on loop-mounted partition/disk images, files or even from/to pseudo-devices like /dev/zero, dev/null
Interesting thing about the name -at first I thought it meant direct-to-disk as that is the way you usually use it. But, it's real name is 'copy-and-convert', but since 'cc' is the name of a compiler, they opted to name it 'dd'!
Really useful for loads of jobs -just last week I implemented a way to use it instead of 'file' to discover some file types(since 'file' can be dangerous on unknown objects) a lot faster than running 'file obj |grep ELF' on hundreds of objects.
laptopkiller, there is no point in using tar on a single object. Suing dd will preserve all the perms effectively as nothing gets inetrpreted. dd copies bit-by-bit or block-by-block without 'reading' any filesystem realted metadata.
Joe will remember a tip I passed him not long ago about using dd to replace barry's 'truncate' program -by inserting a NULL character into a file at a given point, the file gets truncated there.
Disclaimer do not carelessly paste this in a terminal just to see what happens you can and will destroy your boot sector if you don't know what your doing
ok I feel better you have been warned now just read this and be careful
You can back up your MBR of your USB
gives me this output
# dd if=/dev/sda1 of=mbr.bin count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 7.9887e-05 s, 6.4 MB/s
#
then using the hexedit command
gives this output
00000000 EB 58 90 54 48 52 45 45 53 20 20 00 02 08 20 00 .X.THREES ... .
00000010 02 00 00 00 00 F8 00 00 3F 00 20 00 3F 00 00 00 ........?. .?...
00000020 21 DD EE 00 A9 3B 00 00 00 00 00 00 02 00 00 00 !....;..........
00000030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 29 68 67 8E 23 4B 49 4E 47 53 54 4F 4E 20 ..)hg.#KINGSTON
00000050 20 20 46 41 54 33 32 20 20 20 CD 18 8E D1 BC F4 FAT32 ......
00000060 7B 8E C1 8E D9 BD 00 7C 88 4E 02 8A 56 40 B4 08 {......|.N..V@..
00000070 CD 13 73 05 B9 FF FF 8A F1 66 0F B6 C6 40 66 0F ..s......f...@f.
00000080 B6 D1 80 E2 3F F7 E2 86 CD C0 ED 06 41 66 0F B7 ....?.......Af..
00000090 C9 66 F7 E1 66 89 46 F8 83 7E 16 00 75 38 83 7E .f..f.F..~..u8.~
000000A0 2A 00 77 32 66 8B 46 1C 66 83 C0 0C BB 00 80 B9 *.w2f.F.f.......
000000B0 01 00 E8 2B 00 E9 48 03 A0 FA 7D B4 7D 8B F0 AC ...+..H...}.}...
000000C0 84 C0 74 17 3C FF 74 09 B4 0E BB 07 00 CD 10 EB ..t.<.t.........
000000D0 EE A0 FB 7D EB E5 A0 F9 7D EB E0 98 CD 16 CD 19 ...}....}.......
000000E0 66 60 66 3B 46 F8 0F 82 4A 00 66 6A 00 66 50 06 f`f;F...J.fj.fP.
000000F0 53 66 68 10 00 01 00 80 7E 02 00 0F 85 20 00 B4 Sfh.....~.... ..
00000100 41 BB AA 55 8A 56 40 CD 13 0F 82 1C 00 81 FB 55 A..U.V@........U
00000110 AA 0F 85 14 00 F6 C1 01 0F 84 0D 00 FE 46 02 B4 .............F..
00000120 42 8A 56 40 8B F4 CD 13 B0 F9 66 58 66 58 66 58 B.V@......fXfXfX
00000130 66 58 EB 2A 66 33 D2 66 0F B7 4E 18 66 F7 F1 FE fX.*f3.f..N.f...
00000140 C2 8A CA 66 8B D0 66 C1 EA 10 F7 76 1A 86 D6 8A ...f..f....v....
00000150 56 40 8A E8 C0 E4 06 0A CC B8 01 02 CD 13 66 61 V@............fa
00000160 0F 82 54 FF 81 C3 00 02 66 40 49 0F 85 71 FF C3 ..T.....f@I..q..
--- mbr.bin --0x0/0x200-------------------------------------------------
then you can edit and put it back
this is where you need to be extra careful !
Will restore the MBR.
for me to remember these odd codes dd is data dump
then "if" is input file
and "of" is output file
if you dont have hexedit its small 27k
http://puppy2.org/slaxer/hexedit-1.2.12-i486-2-slxr.tgz
you could also use midnight commander "mc"
but thats larger
midnight commander and its required libs
mc-4.6.1_20070623p14-i486-2-slxr.tgz 2009-11-06 2.1M
-->gpm-1.20.1-i486-2-slxr.tgz 2009-11-06 229K
-->slang-2.1.3-i486-2-slxr.tgz 2009-11-06 381K
well why not add a table of some possible drives
this way you can back them up before making an edit
Joe
ok I feel better you have been warned now just read this and be careful
You can back up your MBR of your USB
Code: Select all
dd if=/dev/sda1 of=mbr.bin count=1
gives me this output
# dd if=/dev/sda1 of=mbr.bin count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 7.9887e-05 s, 6.4 MB/s
#
then using the hexedit command
Code: Select all
hexedit mbr.bin
00000000 EB 58 90 54 48 52 45 45 53 20 20 00 02 08 20 00 .X.THREES ... .
00000010 02 00 00 00 00 F8 00 00 3F 00 20 00 3F 00 00 00 ........?. .?...
00000020 21 DD EE 00 A9 3B 00 00 00 00 00 00 02 00 00 00 !....;..........
00000030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 29 68 67 8E 23 4B 49 4E 47 53 54 4F 4E 20 ..)hg.#KINGSTON
00000050 20 20 46 41 54 33 32 20 20 20 CD 18 8E D1 BC F4 FAT32 ......
00000060 7B 8E C1 8E D9 BD 00 7C 88 4E 02 8A 56 40 B4 08 {......|.N..V@..
00000070 CD 13 73 05 B9 FF FF 8A F1 66 0F B6 C6 40 66 0F ..s......f...@f.
00000080 B6 D1 80 E2 3F F7 E2 86 CD C0 ED 06 41 66 0F B7 ....?.......Af..
00000090 C9 66 F7 E1 66 89 46 F8 83 7E 16 00 75 38 83 7E .f..f.F..~..u8.~
000000A0 2A 00 77 32 66 8B 46 1C 66 83 C0 0C BB 00 80 B9 *.w2f.F.f.......
000000B0 01 00 E8 2B 00 E9 48 03 A0 FA 7D B4 7D 8B F0 AC ...+..H...}.}...
000000C0 84 C0 74 17 3C FF 74 09 B4 0E BB 07 00 CD 10 EB ..t.<.t.........
000000D0 EE A0 FB 7D EB E5 A0 F9 7D EB E0 98 CD 16 CD 19 ...}....}.......
000000E0 66 60 66 3B 46 F8 0F 82 4A 00 66 6A 00 66 50 06 f`f;F...J.fj.fP.
000000F0 53 66 68 10 00 01 00 80 7E 02 00 0F 85 20 00 B4 Sfh.....~.... ..
00000100 41 BB AA 55 8A 56 40 CD 13 0F 82 1C 00 81 FB 55 A..U.V@........U
00000110 AA 0F 85 14 00 F6 C1 01 0F 84 0D 00 FE 46 02 B4 .............F..
00000120 42 8A 56 40 8B F4 CD 13 B0 F9 66 58 66 58 66 58 B.V@......fXfXfX
00000130 66 58 EB 2A 66 33 D2 66 0F B7 4E 18 66 F7 F1 FE fX.*f3.f..N.f...
00000140 C2 8A CA 66 8B D0 66 C1 EA 10 F7 76 1A 86 D6 8A ...f..f....v....
00000150 56 40 8A E8 C0 E4 06 0A CC B8 01 02 CD 13 66 61 V@............fa
00000160 0F 82 54 FF 81 C3 00 02 66 40 49 0F 85 71 FF C3 ..T.....f@I..q..
--- mbr.bin --0x0/0x200-------------------------------------------------
then you can edit and put it back
this is where you need to be extra careful !
Code: Select all
dd if=mbr.bin of=/dev/sda1 count=1
for me to remember these odd codes dd is data dump
then "if" is input file
and "of" is output file
if you dont have hexedit its small 27k
http://puppy2.org/slaxer/hexedit-1.2.12-i486-2-slxr.tgz
you could also use midnight commander "mc"
but thats larger
midnight commander and its required libs
mc-4.6.1_20070623p14-i486-2-slxr.tgz 2009-11-06 2.1M
-->gpm-1.20.1-i486-2-slxr.tgz 2009-11-06 229K
-->slang-2.1.3-i486-2-slxr.tgz 2009-11-06 381K
well why not add a table of some possible drives
this way you can back them up before making an edit
Code: Select all
dd if=/dev/hda1 of=hda1mbr.bin count=1
dd if=/dev/hda2 of=hda2mbr.bin count=1
dd if=/dev/hda3 of=hda3mbr.bin count=1
dd if=/dev/hda4 of=hda4mbr.bin count=1
dd if=/dev/hda5 of=hda5mbr.bin count=1
dd if=/dev/sda1 of=sda1mbr.bin count=1
dd if=/dev/sda2 of=sda2mbr.bin count=1
dd if=/dev/sda3 of=sda3mbr.bin count=1
I went to the link you provided and printed the web page to a pdf file.big_bass wrote:efiguy
maybe it is this one?
http://www.linuxquestions.org/linux/ans ... ng_With_DD
its been a few years since I had to low level hex edit a drive to fix The MBR I used the ultimate boot disk cd I don't know if that works on USB drives though
but for the hard drive it did work well
Joe
That way, I have it offline to refer to.
Thank you!