Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Search Forums:



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-31-2010
Registered User
 

Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Command to output ones (like zero-fill), with progress indicator

Well, I was originally going to post this snippet in the original thread titled "how to output ones endlessly like /dev/zero", but that topic was closed without an efficient answer.

It was difficult to find (build) a satisfactory answer to this one, so I thought I'd share it here and as a "fill hard drive with ones like zero-fill" entry on commandlinefu.

This command seems to get me about 500MByte/min, though this is with a 1.5TB 'green' drive running only at 5400rpm so I imagine it'd be faster in most other cases.

Code:
tr '\000' '\377' < /dev/zero | dd bs=512 count=[drive bytes/512] status=noxfer | pipebench | sudo dd of=[output disk/partition, e.g. /dev/sdb]

Hope that helps someone
- Gliktch

P.S: Note that pipebench is required - this is probably available in your distro's repositories
Sponsored Links
    #2  
Old 08-31-2010
Moderator
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 12,192
Thanks: 233
Thanked 1,707 Times in 1,635 Posts
Eight megabytes per second seems a bit slow even for a green drive, I think this can be optimized a bit.

The first dd does nothing but waste time, pipebench can read fine directly from tr. If you mean to fill the entire drive, count is redundant anyway -- dd will stop when it reaches the end. Or you could put bs and count on the final dd instead of the first.

Increasing the blocksize may make it more efficient. It doesn't need to match the drive's block size -- this isn't raw I/O.


Code:
tr '\000' '\377' < /dev/zero | pipebench | sudo dd of=/dev/wtf

It's also possible to get progress statistics from dd itself instead of using pipebench, by sending it SIGUSR1:


Code:
kill -USR1 pid

Sponsored Links
Closed Thread

Tags
1s, drive, fill, pipebench, wipe

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Process indicator with hash marks jaysunn Shell Programming and Scripting 5 08-06-2009 04:20 PM
Command display output on console and simultaneously save the command and its output satimis UNIX for Dummies Questions & Answers 7 01-25-2009 07:27 PM
problem with output of find command being input to basename command... new_learner UNIX for Dummies Questions & Answers 2 12-14-2008 01:56 AM
Progress indicator script ./hari.sh Shell Programming and Scripting 8 10-03-2008 05:37 PM
Korn: How to zero fill df output so it will sort properly shew01 Shell Programming and Scripting 9 06-04-2008 10:34 AM



All times are GMT -4. The time now is 03:02 AM.