I think 40tb will brake the bank 😅 How many lifetimes did you live to have so many photos? Maybe look into the Drobo nas, it has support for different disk sizes and you can upgrade them one by one, dynamically increasing the storage...
Discussion
I used to do a lot of semi-pro photography and got used to shooting in RAW and ProRes so it eats up a lot, ProRes especially. 3 weeks holidays = 4TB of material.
Sure loads of it will eventually be delted - but until then ....
moosefs and consumer hardware was precisely the way to NOT break a bank