Adding to the well detailed explanation I might correct a typo. You can create a hard drive file with either the -chs parameter (cilinders, head, sectors) or the -s parameter, just specify the size in bytes divisible by 512.
For instance "chdman createhd -o ibm5150.chd -s 20971520" creates a 20MB hard drive too, however the CHS values are different and I can't test right now how compatible is with such older computer. I have the habit of renaming my hard drives including the set, chs values and size for easy reference. So my newly generated "ibm5150.chd" turns into "ibm5150_C64_H16_S40_20MB.chd" now.
If you don't want to add the hard drive each time nor type a long parameter list, you can create a custom ini file. Just type something like "mame64.exe ibm5150 -cc" and rename the newly generated mame.ini file to ibm5150.ini, then keep only the values you want to get changed. For example:
# CORE MISC OPTIONS
# SLOT DEVICES
# IMAGE DEVICES
This one adds a sound card, the hard drive and prevents from you accidentally ending emulation while switching between full and partial keyboard emulation.
One more thing. For compatibility reasons the softlist gives you different diskette images depending on you choosing between 5.25" and 3.5" drives. If one diskette gives you read errors, switch between "dd" and "hd" version types on "Slot devices" when available.
EDIT: BTW, bannister has a dedicated topic about installing Operative Systems on MESS now MAME computers.