LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-27-2020, 09:39 AM   #1
E_BOURSEAU
LQ Newbie
 
Registered: Aug 2020
Distribution: Solaris
Posts: 7

Rep: Reputation: Disabled
dd comand :bs parameter unit


Hello
I'm trying to duplicate a whole disk in order to be at ease to run tests. Disk is 18 Gbyte large.
To achieve duplication, I use dd command.

Question is about dd parameter unit.
If I specify bs=512 does it mean it duplicates using block of 512 bytes or 512 K bytes ?

command run :
dd if=dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t9d0s2 bs=512 conv)noerror,sync

The server is equipped with 512 Mbyte of RAM and BUFSIZE is 1024.

Regards.
EB
 
Old 08-27-2020, 10:07 AM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by E_BOURSEAU View Post
Hello
I'm trying to duplicate a whole disk in order to be at ease to run tests. Disk is 18 Gbyte large.
To achieve duplication, I use dd command.

Question is about dd parameter unit.
If I specify bs=512 does it mean it duplicates using block of 512 bytes or 512 K bytes ?

command run :
dd if=dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t9d0s2 bs=512 conv)noerror,sync

The server is equipped with 512 Mbyte of RAM and BUFSIZE is 1024.

Regards.
EB
From the dd(1) man page:

Code:
bs=BYTES
              read and write up to BYTES bytes at a time (default: 512); over-
              rides ibs and obs
I'd bump that value to something like 32K or 64K... at least.

HTH...
 
2 members found this post helpful.
Old 08-27-2020, 10:19 AM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by E_BOURSEAU View Post
dd if=dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t9d0s2 bs=512 conv)noerror,sync
Linux systems are unlikely to have raw disk device files though. Reminds me of HP-UX.
 
1 members found this post helpful.
Old 08-27-2020, 10:26 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I'd do 2M.

And I do believe the K, M, and G modifiers work fine with this command.
 
Old 08-27-2020, 10:58 AM   #5
E_BOURSEAU
LQ Newbie
 
Registered: Aug 2020
Distribution: Solaris
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks for your reply.
I'm trying different bs values.
EB
 
Old 08-27-2020, 01:46 PM   #6
verndog
Member
 
Registered: Oct 2007
Posts: 278

Rep: Reputation: 67
Your missing the front "/" on dev/rdsk/c0t0d0s2. Not sure if you actually executed it or not.
 
Old 08-27-2020, 03:28 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I'd consider a file by file copy. Usually still faster than dd with the best tuning.


There is optimal sizes for drives and there may be some unique choices for various media too.


If some run of dd fails due to damaged areas then consider other tools like dd-rescue or (I forget that other) gdd or something.
 
Old 08-27-2020, 03:33 PM   #8
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by berndbausch View Post
Linux systems are unlikely to have raw disk device files though. Reminds me of HP-UX.
I only recall some "Big Iron" UNIXes using them. Tru64 and Solaris had/have raw disk devices, i.e., "/dev/rdisk/dsk0[a-h]" and "/dev/rdsk/...". I can only remember Oracle as being interested in using them---supposedly for performance reasons.
 
Old 08-28-2020, 12:09 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Use whatever is convenient - I happen to use 4M; habit over the years, it has no particular logic behind the choice. Last time I did some tracing, the value has no effect on the actual I/O issued. On my old laptop with 512-sector disk, chains of 32-sector I/O were issued by dd - I didn't look to see what the I/O scheduler did in the way of consolidation of chains given that all the addresses were consecutive.
 
Old 08-28-2020, 04:04 AM   #10
E_BOURSEAU
LQ Newbie
 
Registered: Aug 2020
Distribution: Solaris
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hello,

dd ends after about 1 or 2 hours of job with no warning.
but destination disk is empty !
I can't post anything today because remote acces is down.
I did't check "/" missing. may be a recopy of what I launched. to be checked.
EB
 
Old 08-28-2020, 04:06 AM   #11
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Can you share the precise command?
 
Old 08-31-2020, 04:32 AM   #12
E_BOURSEAU
LQ Newbie
 
Registered: Aug 2020
Distribution: Solaris
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hello,

here is : dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t9d0s2 bs=4096k conv=noerror,sync
it's running. tell you more when achieved.
Regards.
 
Old 08-31-2020, 04:51 AM   #13
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,487

Rep: Reputation: Disabled
For large transfers with 512MB ram, I'd use bs=300M, this will read & write your disk in 300MB chunks using that much ram for the transfers.
(Your system should work OK with the other 212MB of ram.)

Last edited by fatmac; 08-31-2020 at 04:52 AM.
 
Old 08-31-2020, 05:28 AM   #14
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by E_BOURSEAU View Post
Hello,

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t9d0s2 bs=4096k conv=noerror,sync
Sorry for this question, but is /dev/rdsk/c0t9d0s2 a device file?

If yes, and if the command succeeds successfully, the two disk partitions should have the same content.
How do you check that the destination disk is empty?
 
Old 08-31-2020, 05:39 AM   #15
E_BOURSEAU
LQ Newbie
 
Registered: Aug 2020
Distribution: Solaris
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Sorry for this question, but is /dev/rdsk/c0t9d0s2 a device file?

If yes, and if the command succeeds successfully, the two disk partitions should have the same content.
How do you check that the destination disk is empty?
Sun is equipped with 2 identical disks. 1st one is on slot 0 (c0t0d0) and the 2nd one in slot 2 (c0t9d0).
Slot 0 contains disk I want to duplicate and Slot 2 is destination disk.

dd command end but ls -al command show only 2 directories.

Sur I missed something.

EB
Attached Thumbnails
Click image for larger version

Name:	dd1.PNG
Views:	20
Size:	2.4 KB
ID:	33992  
 
  


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
How do we get my UNIT(service) name in unit.sevice Boobalan M Linux - Software 6 01-23-2018 05:03 AM
shell getopts: opt w/ optional parameter is taking next opt as its parameter! GrapefruiTgirl Programming 22 10-27-2010 06:00 AM
Storage unit and IO unit salmanucit Linux - General 2 06-17-2008 11:11 PM
linux bash - how to use a dynamic parameter in shell parameter expansion expression nickleus Linux - General 2 08-21-2006 04:54 AM
comand to check if program is installed or not? awlad Linux - Newbie 10 05-18-2003 09:34 PM

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

All times are GMT -5. The time now is 03:09 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