What is the best way to concurrent formatting 1000 disks under centos

211 views Asked by At

I've done this work with an expect script which seems working. But I think it must be a more elegant way to do things like this (is Puppet suitable for this job?). So I searched on Google, get nothing. Any suggestions?

UPDATE: I have 100 machines with 10 disks each. By formatting I mean to creating file systems with or without partitioning.

1

There are 1 answers

0
Laszlo Valko On

You don't need any expect scripts. There are CLI tools perfectly usable from plain shell or Perl/Python scripts, that don't need any terminal interaction. For partitioning, you can use sfdisk, for making file systems, you can use the appropriate mkfs.xxx. You can get the current partitioning scheme from sfdisk -d in a wonderful, easy-to-parse format, you can decide whether you want a different partitioning or not, then use sfdisk again to load the new partitioning scheme. mkfs.xxx binaries are also ready to be used from scripts, when used with the proper command-line options.

To handle multiple disks in parallel, I suggest to implement a script for a single disk, and run as many scripts in parallel as needed.