LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 06-30-2006, 05:27 PM   #1
rh_bomani
Member
 
Registered: Apr 2006
Posts: 42

Rep: Reputation: 15
'dd command


hey all,

I'm reading a redhat book and they give an example on how to create a bootdisk and put it on floppy.

dd if=/mnt/cdrom/images/bootdisk.img of=/dev/fd0
mount /dev/fd0 /mnt/floppy
cp ks.cfg /mnt/floppy

###########

How can they 'dd' the img file onto /dev/fd0 if there is no floppy disk inserted? Could I also 'dd' a file onto /dev/hdc (cdrom) if not cd is inserted?


thanks in advance
 
Old 06-30-2006, 05:33 PM   #2
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,262

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
It is assumed that a floppy is inserted.

No you can't dd to /dev/hdc because it is a cdrom device which is read only.
 
Old 06-30-2006, 05:35 PM   #3
rh_bomani
Member
 
Registered: Apr 2006
Posts: 42

Original Poster
Rep: Reputation: 15
ok, the floppy was inserted but was not mounted until the 2nd line.
 
Old 06-30-2006, 07:00 PM   #4
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,262

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
The dd command can write to the device, so the floppy doesn't need to be mounted.
For example, if you have a 30GB hard disk on your laptop you could created a backup of the hard drive image and save it to a mounted external usb drive. Then if the hard drive goes belly up, you can reverse the process.

dd if=/dev/hda of=/media/usbdrive/hda.img bs=512

This will work even if the drive has partition on it. The image file contains the MBR and the partition table.

dd if=/mnt/cdrom/images/bootdisk.img of=/dev/fd0
The bootdisk.img file contains the image of an entire floppy disk including the filesystem. It might of been created with the mkbootdisk command, or might have been copied from a real floppy disk. The dd command writes this image file to the floppy device. So you can start with a blank disk. The image contains the filesystem, so you don't need to format the disk.

mount /dev/fd0 /mnt/floppy
Now that the floppy image is written, the floppy disk contains a filesystem which can be mounted.

And the last line copies the ks.cfg file to the floppy.
cp ks.cfg /mnt/floppy

Make sure you run "umount /dev/df0" before ejecting the floppy disk. The ks.cfg file may still be written to the cache. Because a floppy is so small, the entire filesystem may be cached to speed things up. You need to umount the floppy to save your changes.
 
Old 06-30-2006, 08:41 PM   #5
rh_bomani
Member
 
Registered: Apr 2006
Posts: 42

Original Poster
Rep: Reputation: 15
that explains it well, thanks!
 
  


Reply

Tags
dd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM
Command to display whole filestructure hierarchy f/ command line? mjewell Linux - Newbie 10 01-19-2004 10:48 AM


All times are GMT -5. The time now is 10:16 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration