-1

I have to reformat 28 10TB drives inside a server from 4096 Bytes to 512 Bytes, in order for them to be recognised by the raid controller.

Due to the large capacity, when using the GParted Live CD and the

sg_format --format --size=512 /dev/sdX 

command, the process takes very long for a single drive to complete.

My next guess was to automate the process sequentially by running it inside a bash loop, however, that way it would still take ~3-4 days to complete.

Is there a way to execute this process in parallel? Any help would be appreciated. I don't mind switching to another live CD, however I would prefer to stay with GParted as it was already a pain to boot something on this server.

I formatted the first drive inside a terminal, it has progressed 4% in 30 minutes.

I first tried loading the GParted GUI, however I think somewhere it crapped out (maybe due to me using the HP iLO 4 interface to load .isos) and froze up.

zx485
  • 28,498
  • 28
  • 50
  • 59
ignis
  • 1

1 Answers1

0

I solved this problem using the parallel command. It enables running a task on each cpu core available. You can use the -j option to define the number of cores and the nproc command to see how many are available on your system.

This was the command I used:

for i in {1..28}; do echo "sg_format --format --size=512 /dev/sg$i"; done | parallel -j40

However, in this config, parallel doesn't spit out the progress of the formatting process until the job is done. To achieve this, I think one could use the --ungroup option. Not sure about that though.

Furthermore I highly suggest not terminating a running sg_format command, as it can be pretty cumbersome to reinitialise the drive afterwards.

For reference, this command took ~13-14 hours to terminate on a 10TB SAS drive.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
ignis
  • 1