How to format multiple drives and then create mountpoints and fstab entries?

My JBODs have been finally delivered to me, and now I’m met with a trouble: I have drives from sda through ~ sdhz.
It’s going to take hella lot time to format them all to ext4, create mountpoints and append them with UUIDs to the fstab.
Are there any commands out there that can help me to have a little bit of automatization for my needs?

1 Like

I parse the “blkid” output to generate the fstab file. For formating I use a bash script

Can you up the bash script? Would like to see it.
I go the manual route with GParted and give friendly names to the drives.

i use always stripped JBOD of at least 4-8 drives for better space utilization…faster speed. don’t use ext4…it is crap for management of large space…XFS

1 Like

Use the -L option in mkfs to add a label when creating the partition. I label mine with the serial number of the drive. I then create a mountpoint that is named according to the slot where the drive is loaded. If a drive goes bad, you get the location and the serial number to know which one to pull.
The fstab entry loads by label rather than uuid.


here you go


If a drive crashes, this leaves you searching for the uuid that isn’t there. Also, leaves you searching for the SN that is not reported in the system. I think these scripts would work great for folks with 10 drives in a box, but fall apart when dealing with 20+ drives. Not a problem if everything continues to run smoothly, but a mess if something breaks.