LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 07-26-2012, 09:02 AM   #1
zackmax
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Rep: Reputation: Disabled
writing data to fill a 1 TB disk


hi everyone:

I have to run a test with a drive that needs to be 1 TB but needs to have 10 GB of data after every 100 GB.

Like this:

10 GB data
100 GB free
10 GB data
100 GB free
10 GB data
...

I know this can probably be done with dd command but I would appreciate some help and I cannot figure out the correct switches.

Thank you for your help!
 
Old 07-26-2012, 10:40 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Yes, "dd" in loop can do it:
Code:
dd if=/dev/random of=/dev/sdx conv=notrunc oflag=append bs=1G count=10 seek=100
Where /dev/sdx is a drive you want to write (be aware that it destroy whole data on it, but you can also use a partition name or ordinary filename) and argument for "bs" depends on available memory, you can lower it and raise "count" and "seek" accordingly if you get message about low memory. Just enclose it within some loop.

I do not known if "conv=notrunc oflag=append" is appropriate for devices, if not then you need create some more advanced loop with progressive "seek".

Last edited by eSelix; 07-26-2012 at 10:43 AM.
 
1 members found this post helpful.
Old 08-03-2012, 03:58 PM   #3
zackmax
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by eSelix View Post
Yes, "dd" in loop can do it:
Code:
dd if=/dev/random of=/dev/sdx conv=notrunc oflag=append bs=1G count=10 seek=100
Where /dev/sdx is a drive you want to write (be aware that it destroy whole data on it, but you can also use a partition name or ordinary filename) and argument for "bs" depends on available memory, you can lower it and raise "count" and "seek" accordingly if you get message about low memory. Just enclose it within some loop.

I do not known if "conv=notrunc oflag=append" is appropriate for devices, if not then you need create some more advanced loop with progressive "seek".

Thank you for your help!
 
Old 08-03-2012, 06:17 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
"seek" is the answer here. "append" would try to append to the end of the device, not wherever you happened to stop writing last time, causing an immediate "No space left" error and no data transferred.
 
1 members found this post helpful.
Old 08-03-2012, 07:14 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Is pseudo-random data really a requirement? If not, using /dev/zero as input would be a lot more efficient than /dev/random (or /dev/urandom).
 
1 members found this post helpful.
Old 08-03-2012, 08:28 PM   #6
zackmax
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by anomie View Post
Is pseudo-random data really a requirement? If not, using /dev/zero as input would be a lot more efficient than /dev/random (or /dev/urandom).
nope not a requirement. I will remember this for next time. Thank you!
 
Old 08-04-2012, 01:43 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
If you want to "fill" a device e.g. to erase it, consider that many disk drives are able to perform "on-board diagnostics" (such as "SMART") independently of what they do in response to CPU-initiated commands. The disk drive itself might be capable of executing a "data security erase."
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing data to a raw disk using dd barunparichha Linux - Software 3 02-09-2012 02:26 PM
Writing to tty causes writing to disk? (in ancient 2.2.x kernel) borsburn Linux - Kernel 0 12-17-2008 12:47 PM
floppy only reads first disk, if new disk is inserted data from first disk is shown. lakosked Debian 3 02-18-2006 08:44 PM
writing encrypted data to disk rblampain Linux - Security 14 07-31-2005 11:38 PM
Writing encrytped data to a disk tyler_durden Programming 2 04-17-2002 11:18 PM

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

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