I tried this

xargs -p 5 -n1 mke2fs -t ext4 /dev/sd[d-p]1

and got this

[/dev/mapper]# seq 1 15 | xargs -p 5 -n 1 mke2fs -t ext4 /dev/sd[b-p]1 5 -n 1 mke2fs -t ext4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1 /dev/sdh1 /dev/sdi1 /dev/sdj1 /dev/sdk1 /dev/sdl1 /dev/sdm1 /dev/sdn1 /dev/sdo1 /dev/sdp1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ?...

Also tried this

[/dev/mapper]# xargs -p 5 -n 1 mke2fs -t ext4 /dev/sd[b-p]1

and got nothing. Any ideas? what ami doing swo

  • 1
    That puts a heavy I/O load, and doing it in parallel doesn't make any sense unless they are connected to separate controllers – vonbrand Jan 15 '16 at 16:24
  • @vonbrand Are you sure? If the disks are slow SATA disks, then I would imagine most time was spent waiting for the platter to spin/seeking. Have you tested your claim? If so would you share the numbers with us? – Ole Tange Jan 18 '16 at 2:31

Using GNU Parallel you would do this:

parallel -P 5 mke2fs -t ext4 ::: /dev/sd[d-p]1

Try this:

 echo -e "/dev/sdb\n/dev/sdc\n/dev/sdd" | xargs -P0 -n1  mkfs.ext4
  • xargs delimits by blank spaces by default, so you don't need the \n there at all. – Luke Peterson Jan 17 '16 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.