LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices


Reply
  Search this Thread
Old 10-23-2005, 09:44 PM   #1
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Post DISCUSSION: How To Do Eveything With DD


This thread is to discuss the article titled: How To Do Eveything With DD
 
Old 10-28-2005, 12:04 PM   #2
sk545
Member
 
Registered: Aug 2002
Posts: 312

Rep: Reputation: 30
wow, excellent.
 
Old 03-12-2006, 06:29 PM   #3
Rich309
LQ Newbie
 
Registered: Feb 2006
Location: Iowa
Posts: 4

Rep: Reputation: 0
Do you mean to say BS= can not be less than 512? I have run it at 2 and it seem to work. Am I being decieved?
 
Old 03-24-2006, 10:55 AM   #4
w_r_cromwell
Member
 
Registered: Feb 2006
Location: Michigan
Distribution: RedHat9, Core6, Ubuntu5.1
Posts: 42

Rep: Reputation: 18
This is very helpful... thanks for your effort

Bill
 
Old 12-13-2006, 06:56 AM   #5
anilbh
Member
 
Registered: Oct 2005
Location: India
Distribution: Proud User Fedora FC5/ Fedora 7 /Ubunt 7.10
Posts: 188

Rep: Reputation: 30
Lightbulb Amazing

Wow is right ! But I had a tough time locating this article again .
 
Old 06-01-2007, 11:19 AM   #6
harryhaller
Member
 
Registered: Sep 2004
Distribution: Slackware-14.2
Posts: 468

Rep: Reputation: Disabled
when dd copies a partition, does it also copy the super-block?

In other words, if I copied my windows partition and then restored it, could I then boot from it, assuming, of course, that my boot manager was set up correctly?

Also, could I gezip the file of the partition to make it smaller, or does that cause problems when restoring?
 
Old 06-01-2007, 11:51 AM   #7
kav
Member
 
Registered: May 2006
Location: USA
Distribution: FreeBSD Ubuntu Debian
Posts: 137

Rep: Reputation: 15
Quote:
Also, could I gezip the file of the partition to make it smaller, or does that cause problems when restoring?
I know there's got to be a way to do that manually, maybe even piped into one line. Clonezilla has that kind of functionality except with an easy to follow menu to get it all done. Wonderfull tool.

Heck, it might be as easy as $ dd if=/somefile | tar -czvf /compresed_image
 
Old 10-05-2007, 12:50 PM   #8
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Rep: Reputation: 85
Quote:
Copy a disk partition to a file on a different partition. Do not copy a partition to the same partition.

dd if=/dev/sdb2 of=/home/sam/partition.image bs=4096 conv=notrunc,noerror

This will make a file that is an exact duplicate of the sdb2 partition. You can substitue hdb, sda, hda, or whatever the disk is called.

Restore a disk partition from an image file.

dd if=/home/sam/partition.image of=/dev/sdb2 bs=4096 conv=notrunc,noerror
Could someone please explain why bs=4096 and conv=notrunc,noerror is used?
 
Old 12-21-2007, 01:49 PM   #9
DrCR
LQ Newbie
 
Registered: Aug 2006
Distribution: Slackware14, VectorLinux5.9SOHO
Posts: 21

Rep: Reputation: 0
bs=446 count=1 is way to backup the MBR, but not the partition table, so yes, it can be less than 512.
bs=4096 - When copying large amounts, say, backing up a partition, bs=4096 tends to be the best choice for faster, more modern machines so I hear.

You can indeed compress on the fly, via piping. For example, here's the command I recently used to backup one of my partitions:
dd if=/dev/sda1 bs=4096 | bzip2 > OSXsda1_ddbackup.bz2

I don't know anything about conv= stuff...I haven't read the review yet, but still wanted to answer so of your questions.

DrCR

_______________
A5N8X, 3500+ single-core Manchester, 2x512MB Corsair XMS, MSI 7600GT
S-12 430W, HR-05, Scythe Mime, VF900 modded with Scythe 80x25mm. Dual D12SL-12 Yate Loons
WD1200JB, WD3200JB, HD501LJ
Dual, independant WinXP installs via Grub hiding, VectorLinux 5.1.1SOHO, 5.8SOHO.
- - -
MacBook Pro Santa Rosa, 2.2GHz, 250GB Scorpio, Ceramique compound, Pending Appled-Tux Logo mod
MBRed Hard Drive with: OSX, WinXP, Vista (MSDN, pending), Sidux 2007-03
Pending Fusion "bootcamp" VMs pointing to native OS installs
 
Old 01-18-2010, 01:37 AM   #10
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
I am trying to mirror partitions from one harddisk to another.

At first I tried to mirror the whole harddisk to one of similar size and model.

Code:
dd if=/dev/sda of=/dev/sdb bs=4k conv=noerror 2
It managed to copy every bit correctly except for the var partition. So i cleaned up the partition table of sdb and mirror the rest manually, i.e.

Code:
dd if=/dev/sda7 of=/dev/sdb7 bs=4k conv=noerror 2
Strangely, it refuses to copy anything inside the www directory. I've tried many times with the same result - /var/www is empty in the target harddisk.

I do this all the time without any problem on Debian Etch. On this Debian Lenny box, mirroring other partitions seems fine except for /var.

Is there anything that I can trobleshoot? Logging the output showed no error encountered.
 
Old 01-21-2010, 08:45 AM   #11
tukidid
LQ Newbie
 
Registered: Jan 2010
Posts: 6

Rep: Reputation: 0
image remote disk

if remote share is connected as
smb://ipnumber/share
could you use just one dd piped to another
and do you need root privilleges on local and
remote machine for that?
 
Old 01-24-2010, 06:12 PM   #12
DrCR
LQ Newbie
 
Registered: Aug 2006
Distribution: Slackware14, VectorLinux5.9SOHO
Posts: 21

Rep: Reputation: 0
Yep, should work

Yeah, if you booted up from a live CD, mounted a samba share to a NAS or some such, you shouldn't have any problem dding over an image of the local hard drive or a partition on the local hard drive to the NAS.

Just bare in mind it may take a good while, even over gig-E. There was one dd-like app, irrc for Linux, but perhaps unix, that has a nice transfer status. But really all you have to do is have a rough idea of how big the backup file should be and just check out the file properties on the shamba share, occasionally refreshing, to see its progress.


jasontn, just to verify, you do have the /dev/sda7 and /dev/sdb7 unmounted, correct? Most of var is temp stuff, but iirc at least some of it sticks between boots e.g. iirc there's an Apache file in www that is used as the default webpage for an Apache install.

HTH
 
Old 02-01-2010, 11:43 PM   #13
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
Quote:
Originally Posted by DrCR View Post
jasontn, just to verify, you do have the /dev/sda7 and /dev/sdb7 unmounted, correct? Most of var is temp stuff, but iirc at least some of it sticks between boots e.g. iirc there's an Apache file in www that is used as the default webpage for an Apache install.

HTH
/dev/sdb7 was not mounted when copying was done. The server was idle hence little writing activity when copying. Not a single file, not even the index.html file was copied, from the www directory. I even tried placing other files there, which was also not copied.

I have done this before on live servers, running Debian Etch, flawlessly. It is only now that I'm doing this on Deban Lenny. I don't know if this problem is OS related. Unfortunately, I don't have another machine to reproduce this.
 
Old 02-01-2010, 11:57 PM   #14
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by jasontn View Post
/dev/sdb7 was not mounted when copying was done. The server was idle hence little writing activity when copying. Not a single file, not even the index.html file was copied, from the www directory. I even tried placing other files there, which was also not copied.
"little writing activity" would still result in an inconsistent image; there must be no writing activity.
 
Old 02-02-2010, 10:43 AM   #15
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
Quote:
Originally Posted by catkin View Post
"little writing activity" would still result in an inconsistent image; there must be no writing activity.
Is it safe to unmount the /var partition when the server is running? I normally schedule the copying in the middle of the night when there is no user accessing. It is only accessed by users in the same country.
 
  


Reply

Tags
boot, dd, partitions


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
DISCUSSION: Becoming Unplugged jeremy LinuxAnswers Discussion 3 02-14-2007 05:54 AM
Fedora 3 fogets eveything Ian_Hawdon Linux - Software 6 05-18-2005 04:36 PM
Discussion LinuxRam General 5 08-24-2004 06:58 AM
Discussion: Why use C/C++? Strike Programming 106 08-21-2004 02:09 AM
Serious Discussion nbjayme Linux - Newbie 2 09-24-2003 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion

All times are GMT -5. The time now is 09:49 AM.

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