LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-10-2006, 02:32 PM   #61
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Original Poster
Rep: Reputation: 162Reputation: 162
Correction noted


Quote:
Originally Posted by Lotharster
This is not correct. Both random and urandom can in theory produce output of any byte size. They use the kernel's entropy pool to compute the random numbers. This entropy pool is filled with random noise gathered from device drivers and other sources. The important difference between the two is that /dev/random produces only as many random bits as the entropy pool contains. This results in high quality randomness, which is neccessary for kryptographic keys. In case the user demands more random bytes than currently contained in the entropy pool, the process stops until the entropy pool is refilled (waggling your mouse helps). /dev/urandom, however, does not have this restriction. If the user demands more bits than currently in the entropy pool, it produces them using a pseudo random number generator. These pseudo random numbers should not be used as cryptographic keys.
[/QUOTE]


I have made the correction
 
Old 01-10-2006, 03:35 PM   #62
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Original Poster
Rep: Reputation: 162Reputation: 162
You need partitions first

Quote:
Originally Posted by jon_flanders
I would like to clone my 13 gb windows 98 drive, divided into c: programs and d: data to a 100 gb drive via usb which I would pre-partition to say, c: 20gb , d: 30 gb.

The goal would be to then simply pop the 100 gb drive into the ide ribbon in place of the 13 gb drive. My Linux drive is currently 30gb which is sufficient for my purposes. Here's the output of df currently:

[jon@localhost ~]$ df
Filesystem Size Used Avail Use% Mounted on
/dev/hdb5 4.9G 3.6G 1.1G 78% /
/dev/hdb3 5.7G 3.3G 2.3G 60% /home/data
/dev/hda1 5.8G 5.1G 663M 89% /mnt/win_c
/dev/hda5 6.9G 4.2G 2.8G 60% /mnt/win_d
[jon@localhost ~]$

I have unmounted partitions and unused space on the 30gb drive.

Is this doable? I know I can partition the hard drive in the usb via Mandriva's Harddrake. I've done that already with an old 3gb drive.

Jon Flanders
I want to make this clear that you have two drives in the case, connected to IDE. You want to take a third drive, connect it via usb, and copy the partitions on hda to it. You will be running a desktop linux installation, and like the GUI stuff. That's fine. You can use hotplug, and just plug in the usb drive. Wait a second. In a terminal window <dmesg | tail>. Look at where linux put the usb device. It will be hd something, or sd something. Once you know the right device, you can proceed to use cfdisk or parted to partition and format your new partitions. Sector size is 512, don't specify cylinders, heads is 255, sectors per track is 63. I want you to learn the partitioning tool by messing it up a few times(man cfdisk). That way, when you have to rescue a partition, and you don't have man, at least you will have learned the tool. cfdisk has a nice user interface. When the new partitions are created, use dd to transfer the data:

dd if=/dev/hda1 of=/dev/usbpartition bs=4096 conv=notrunc,noerror
dd if=/dev/hda5 of=/dev/usbpartition bs=4096 conv=notrunc,noerror

I know you can do it. I have faith in you.
 
Old 01-10-2006, 03:41 PM   #63
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Original Poster
Rep: Reputation: 162Reputation: 162
Lightbulb Partitions

Quote:
Originally Posted by jon_flanders
I would like to clone my 13 gb windows 98 drive, divided into c: programs and d: data to a 100 gb drive via usb which I would pre-partition to say, c: 20gb , d: 30 gb.

The goal would be to then simply pop the 100 gb drive into the ide ribbon in place of the 13 gb drive. My Linux drive is currently 30gb which is sufficient for my purposes. Here's the output of df currently:

[jon@localhost ~]$ df
Filesystem Size Used Avail Use% Mounted on
/dev/hdb5 4.9G 3.6G 1.1G 78% /
/dev/hdb3 5.7G 3.3G 2.3G 60% /home/data
/dev/hda1 5.8G 5.1G 663M 89% /mnt/win_c
/dev/hda5 6.9G 4.2G 2.8G 60% /mnt/win_d
[jon@localhost ~]$

I have unmounted partitions and unused space on the 30gb drive.

Is this doable? I know I can partition the hard drive in the usb via Mandriva's Harddrake. I've done that already with an old 3gb drive.

Jon Flanders
If you want the new partitions different sizes than the ones being copied, make the new partitions first. Hotplug the usb drive, <dmesg | tail> in a terminal, view the new device designation in dmesg, <man cfdisk>, or install cfdisk, partition disk.

dd if=/dev/hda1 of=/dev/usbpartition bs=4096 conv=notrunc,noerror
dd if=/dev/hda5 of=/dev/usbpartition bs=4096 conv=notrunc,noerror
 
Old 01-11-2006, 10:37 AM   #64
Bengan
Member
 
Registered: Dec 2005
Location: Sweden
Distribution: Mandriva 2006
Posts: 30
Blog Entries: 3

Rep: Reputation: 15
Would it be possible to copy a directory tree to an image file and vice versa?
 
Old 01-11-2006, 11:10 AM   #65
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
Quote:
Originally Posted by Bengan
Would it be possible to copy a directory tree to an image file and vice versa?
Basically, no. The image file needs to contain a WHOLE filesystem. If you want to make a copy of a directory tree into a single file, use tar.
 
Old 01-18-2006, 05:39 PM   #66
sfrazier9999
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
DD Hard Drive to a File

I have read through this article. Very in-depth and I appreciate what you have done to explain DD. I might be asking something that you give in your example, so I will apologize in advance, if not, here is my question.

I would like to copy either the entire hard drive or each partition to a single file for which I could restore back to another hard drive later. Kind of like copy one drive to another (making a duplicate), but I don't want to do that. I want to make a copy of a hard drive to a file, store the file some where and then be able to restore that file to another hard drive. End result would be an exact copy of the first drive. The reason I don't want to do a disk to disk copy is, that the new hard drive might be the same size or larger and I do this later.

Scenario # 1

PC has 2 hard drives.

1. I would like to DD the entire Hard Drive to a single file on the 2nd hard drive
A. What would that command look like if I can do it. However, if possible, can I
only copy actual data or will it copy sector by sector. In other words if /dev/sda
is 20 Gigs, my file will be 20 Gigs. Let's say there was only 7 Gigsof data on
drive, can my file be just 7 Gigs?


Scenario # 2

PC has 1 hard drive and a DVD Burner

1. Hard drive is 20 Gigs. I have 4 gigs of Data that I would like to copy to a
single file and burn it to a DVD.
A. What would the command look like to do that if possible.
 
Old 01-19-2006, 02:09 PM   #67
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,066

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
You could better use tar (standard Linux) or star (enhanced tar, freely downloadable from the Internet) for this purpose. It does exactly what you want, preserves everything from the files, compresses if you want, and when unpacking you re-create the entire tree structure.

The advantage is that is does not matter on which disk or which partition you do this, even if your partition scheme is greatly different.

Since your partitions are different, you'd have to partition your disk anyway.

(I know it works, I cloned several machines like this)

The only problem might be your boot sector. You recreate that most easily by running grub-install from a live CD after you copied all the files.

jlinkels
 
Old 01-19-2006, 02:18 PM   #68
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
would you mind posting the steps to do this? I know it's not the topic of this thread but....
 
Old 01-22-2006, 05:12 AM   #69
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Original Poster
Rep: Reputation: 162Reputation: 162
Lightbulb

Quote:
Originally Posted by sfrazier9999
I have read through this article. Very in-depth and I appreciate what you have done to explain DD. I might be asking something that you give in your example, so I will apologize in advance, if not, here is my question.

I would like to copy either the entire hard drive or each partition to a single file for which I could restore back to another hard drive later. Kind of like copy one drive to another (making a duplicate), but I don't want to do that. I want to make a copy of a hard drive to a file, store the file some where and then be able to restore that file to another hard drive. End result would be an exact copy of the first drive. The reason I don't want to do a disk to disk copy is, that the new hard drive might be the same size or larger and I do this later.

Scenario # 1

PC has 2 hard drives.

1. I would like to DD the entire Hard Drive to a single file on the 2nd hard drive
A. What would that command look like if I can do it. However, if possible, can I
only copy actual data or will it copy sector by sector. In other words if /dev/sda
is 20 Gigs, my file will be 20 Gigs. Let's say there was only 7 Gigsof data on
drive, can my file be just 7 Gigs?


Scenario # 2

PC has 1 hard drive and a DVD Burner

1. Hard drive is 20 Gigs. I have 4 gigs of Data that I would like to copy to a
single file and burn it to a DVD.
A. What would the command look like to do that if possible.
Thanks for the kudos on the OP. The way you do what you want <of=/path/file> instead of a device
 
Old 01-22-2006, 07:47 PM   #70
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,066

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
Quote:
Originally Posted by microsoft/linux
would you mind posting the steps to do this? I know it's not the topic of this thread but....
apt-get install star
man star

jlinkels
 
Old 01-27-2006, 11:50 AM   #71
blakegrover
LQ Newbie
 
Registered: Jan 2006
Posts: 2

Rep: Reputation: 0
I've got a question and I read through thr first page of this thread but I was wonddering if you knew of a way to do the thing I am trying to do. First this is my system setup:

1 DVD Burner
1 80 GB Hard Drive - used for my iso files and backups
1 30 GB Hard Drive - Used for my linux system
1 Swappable hard drive

What I would like to do is we have a lot of servers for our hosting service and we would like to copy the hard drives that are in each type of machine onto a DVD disc and a hard drive so in case we have a problem with a machine we can either copy the extra hard drive for that machine to a new one and put in the machine and get it working or have a copy on a dvd and jsut copy the dvd to a new hard drive.

The only way I can do it right now is I use dd to copy the hard drive from our server in my swappable hard drive bay over my 80 GB hard drive and then I can pull it out and put in the new one and copy over the data back. I have noticed you can use dd to make iso's but I don't know if the dvd will have all the partitions like the hard drive. I also noticed if the hard drive being copied is bigger than the source you need to skip the first part of the drive.

Can you help me know which commands I would need to use to do the following?

1. Copy a hard drive to a directory on my computer as a ISO. I think this one will do it:
dd if=/dev/hda of=/data/beta.iso bs=2048 conv=notrunc
2. Take an iso and copy it onto the hard drive to make it look like the previous hard drive.
3. Also be able to use the same ISO and burn a DVD.

Thanks for your help and if you have any suggestions on how I could do it differently I am open to suggestions.

Thanks
Blake
 
Old 01-27-2006, 11:53 AM   #72
blakegrover
LQ Newbie
 
Registered: Jan 2006
Posts: 2

Rep: Reputation: 0
I just read this last page and it looks like other have suggested to use tar, could I use the if=/path/my.iso ? If so that would help a lot.

p.s. sorry about posting and not reading this last page, you have a great FAQ on this command

Thanks
Blake
 
Old 01-29-2006, 09:39 AM   #73
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Original Poster
Rep: Reputation: 162Reputation: 162
Arrow .iso files and dd

Quote:
Originally Posted by blakegrover
I've got a question and I read through thr first page of this thread but I was wonddering if you knew of a way to do the thing I am trying to do. First this is my system setup:

1 DVD Burner
1 80 GB Hard Drive - used for my iso files and backups
1 30 GB Hard Drive - Used for my linux system
1 Swappable hard drive

What I would like to do is we have a lot of servers for our hosting service and we would like to copy the hard drives that are in each type of machine onto a DVD disc and a hard drive so in case we have a problem with a machine we can either copy the extra hard drive for that machine to a new one and put in the machine and get it working or have a copy on a dvd and jsut copy the dvd to a new hard drive.

The only way I can do it right now is I use dd to copy the hard drive from our server in my swappable hard drive bay over my 80 GB hard drive and then I can pull it out and put in the new one and copy over the data back. I have noticed you can use dd to make iso's but I don't know if the dvd will have all the partitions like the hard drive. I also noticed if the hard drive being copied is bigger than the source you need to skip the first part of the drive.

Can you help me know which commands I would need to use to do the following?

1. Copy a hard drive to a directory on my computer as a ISO. I think this one will do it:
dd if=/dev/hda of=/data/beta.iso bs=2048 conv=notrunc
2. Take an iso and copy it onto the hard drive to make it look like the previous hard drive.
3. Also be able to use the same ISO and burn a DVD.

Thanks for your help and if you have any suggestions on how I could do it differently I am open to suggestions.

Thanks
Blake
Blake, Thanks for the kudos on the post, and to the excellent string of replies. I try to reply to every question myself, but I compliment others who have replied excellently, and have even caused me to edit the post.

DD is a bitstream duplicator. It reads/writes bit for bit. The copy is an exact bitstream duplicate of the original. Therefore, whatever file system is used for the original will be used for the copy. In other words, naming a file with an iso extension does not cause dd to write an iso9660 filesystem if the source file system is not iso9660. You can, however, write other file systems to a DVD with mkisofs and growisofs. There are linux programs available to back up to DVD, if you don't want to learn the other two commands. The fact that dd won't write to optical media is an endless pain, but that is the way it has to be.
 
Old 02-07-2006, 08:17 PM   #74
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,066

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
I would like to add something about the "you copy a file system" statement.

Recently I copied a disk to another one with a bigger size. I used to use tar for this, but I did it with dd this time.

The new disk booted & worked fine, but when I issued a "df" command, all my partition sizes were reported wrong. Indeed, "df" reported all partition sizes like they were on the old, smaller disk.

This obviously happened because I copied the entire FILE SYSTEM, not the data. At the end of the day I tar-ed all the partitions, put the tar files on a different partition. Reformatted the partitions and un-tar-ed everything again, and all was fine.

IMHO this demonstrates clearly that if you want to CLONE a disk, you should use "dd". But if you want to copy a [disk | partition] to something with a different size, you should use "tar".

jlinkels
 
Old 02-07-2006, 08:34 PM   #75
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
You could copy it (with dd) and use a resizing tool to make the filesystem occupy the full space of the new partition.
 
  


Reply

Tags
backup, best, clonezilla, cloning, command, data, dd, disk, drive, duplicate, erase, explanation, formatting, ghost, hard, image, iso, memory, ping, popular, recover, recovery, rescue, search, security, stick, upgrade, usb, wipe


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learn The DD command AwesomeMachine Linux - Newbie 17 08-17-2006 04:22 AM
The best way to learn? iz3r Programming 7 02-06-2005 11:00 PM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 03:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 01:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 01:02 AM


All times are GMT -5. The time now is 12:59 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 Google+: linuxquestions
Open Source Consulting | Domain Registration