LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-05-2009, 04:17 AM   #1
GottaLearnLINUX
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Rep: Reputation: 0
Sorry another dd question


Greetings everyone, I am new to linux, I have a hdd running win xp and Kubuntu(how I did it, I don't remember). My question is about dd.
I have a bootable 128MB CF card in a USB card reader, I want to back it up. I have used the following:

$ dd if=/media/disk of=/home/backup/test.iso

and this is the result:

dd: reading `/media/disk': Is a directory
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.001155 s, 0.0 kB/s

When I check the drive with Dolphin it doesn't give me the option of unmounting the CF drive, I believe the drive is /dev/sdb/sdb1.
I think /dev/sdb is mounted to /media/disk because I see the files and folders that I want to backup there.

What am I doing wrong?

I ran
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 1019:0c55 Elitegroup Computer Systems (ECS) USB Flash Reader, Desknote UCR-61S2B
Bus 002 Device 002: ID 043d:0072 Lexmark International, Inc. X6170 Printer
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub.

I got the dd and lsusb commands from this forum.

Thanx
 
Old 08-05-2009, 04:26 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, welcome to LQ!

For dd to back the CF card up you want to use the raw device,
not the mounted file-system as the origin.

Something like (assuming the dev entry is correct - check dmesg
output to make sure):

dd if=/dev/sdb1 of=your.img bs=2048


Cheers,
Tink
 
Old 08-05-2009, 04:28 AM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
I think you want to read from the raw device, not the mounted directory. Thus, replace /media/disk with /dev/sdb1, and you should be good to go.

That is assuming /dev/sdb1 is the correct device. Check the output of the mount command (without arguments) to see what's mounted where. Look for the output relating to /media/disk.
 
Old 08-05-2009, 04:54 AM   #4
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by GottaLearnLINUX View Post
dd.
I have a bootable 128MB CF card in a USB card reader, I want to back it up. I have used the following:

$ dd if=/media/disk of=/home/backup/test.iso
1. first find out the device name of your CF card (it used
to be /dev/sd[a-z] but it has changed recently).
Insert your card, wait for a few seconds then run this command:

cat /proc/partitions

Toward the end of the output in the last column you should see
your device name
For instance, on my computer
when I insert my digital camera memory card I get this

.... mmcblk0p1

2. now use dd on /dev/the_name_you_just_saw

In my case I would do this

cd
dd if=/dev/mmcblk0p1 of=backup.img

just replace by the device you got, and the name and location
of your output file
 
Old 08-05-2009, 11:05 AM   #5
GottaLearnLINUX
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Original Poster
Rep: Reputation: 0
changing disk size

Greetings and thank all of you for your very prompt help, the 128MB CF was /dev/sdb,
I was able to copy it, the rewrite was slow but it worked.
I had to use sudo to get permission first.

I didn't write the bs=2048 when I copied it back
sudo dd if=/home/test.img of=/dev/sdb
does bs=2048 make it write faster?

How do I put this 128mb image on a 256MB or a 512MB CF

I am anxious to learn linux and leave my dependancy of windows.
I'm comfortable using the command line but, I don't know too many commands

thanks again
 
Old 08-05-2009, 11:17 AM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hi,

I just wanted to throw in a friendly FYI: There's an *excellent* post/tutorial on LQ somewhere, by a member named 'Awesome Machine', titled 'Learn the dd command' or something very similar to this title.

It goes into detail of MANY examples of using dd to do lots of neat stuff!

You can find it here

Sasha
 
Old 08-05-2009, 12:04 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
How do I put this 128mb image on a 256MB or a 512MB CF
You just dd it to the device:

Code:
sudo dd if=/home/test.img of=/dev/sdc
but thereafter it'll be seen as a 128MB device (not 256 or 512MB) until you repartition it. There's no "harm" in this, it's just that dd copies over the partition table as well as the filesystem if you use it like this. So the 512MB device will (lie and) say it is only 128MB.

The first time I copied a partition to a file with dd, and then mounted that file as a filesystem (so I could read and write files from & to it) was a real eye-opener for me, as I realised I could never have done that with DOS / windows. So dd can be quite seductive, but always be very careful with the dd command making triply sure the destination is correct, or you'll hose some vital data.

Now I almost never use dd as there are usually better, safer, tools / methods to achieve what I want.

Explore, experiment (after backups, please), have fun and learn something new
 
Old 08-05-2009, 12:10 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And with that said: you can use parted or its graphical
cousin gparted to resize the migrated partition after the
fact .... (depending on the file-system on there, of course).

Out of curiosity:
What makes you use dd instead of e.g. a cp?


Cheers,
Tink
 
Old 08-06-2009, 07:32 PM   #9
GottaLearnLINUX
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Speeding up

Greetings all, and thank you for your help.
I was able to copy the CF card, is there part of the dd command that can speed up the file transfer?

I don't use Linux much but I'm trying to do a complete move to Linux once I get the programs I use to work with it, I've tried WINE but not everything works with it, like an EPROM programmer connected to a PCI card parallel port and my Lexmark X6170 printer and other hardware.

I have Debian, Suse, Knoppix, Ubuntu disks around here but I installed Kubuntu and winxp on this machine.

Again, thanks for all the help.
 
Old 08-06-2009, 08:59 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by GottaLearnLINUX View Post
Greetings all, and thank you for your help.
I was able to copy the CF card, is there part of the dd command that can speed up the file transfer?
Increasing the block-size should. bs=2048, for example...


But I'd like you to understand that you're NOT transferring
files, not even file-systems. You're copying the devices
content on a hardware-level.

And dd's default is to do that byte by byte, which isn't
the smartes choice for block-devices. Hence the suggested
block-size ... 2048 works well with most block-devices,
if it were a RAID with a large stripe-size you could up
that to e.g. 16384
 
Old 08-08-2009, 10:51 PM   #11
GottaLearnLINUX
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Speeding up data transfer

Greetings, I did some tests on my CF card, I increased bs=8192 and went up to 32768 and found no difference in the speed after 8192, the transfer rate was 1MB/s did a 512MB card in 8 minutes.

Thanks again
 
Old 08-09-2009, 01:48 AM   #12
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
I often use dd to copy whole windows-drives. I connect two HDs in on computer and boot with a slax live-CD.
With linux the only reason for copying raw data is when doing something with the masterbootrecord.
A linux system (other than windows) can be copied completely using "cp" since the system is "connected" to the harddrive only by /etc/fstab and the settings for the bootloader.

Markus

Last edited by markush; 08-09-2009 at 01:49 AM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux distro question & mysql install question natalie.aloi Linux - Newbie 5 07-19-2009 08:28 PM
SPAM question - General Internet Security question LuggerHouse Linux - Security 1 09-07-2007 08:30 AM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM
login prompt question & kde scheme question JustinCoyan Slackware 2 06-09-2004 02:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:48 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration