In both cases the shear volume of necessary oxygen (and other
elements used in human breathable air) would make it very
difficult or impossible to build such a habitat, no?
No, actually; I don't think so.
The accepted atmospheric composition of Earth is 78% nitrogen, 21% oxygen, 0.9% argon, and 0.05% everything else, including carbon dioxide (about 0.04% carbon dioxide and 0.01% everything else, roughly). This is from research by NOAA, Wallace and Hobbs, Vaughan, etc. Lots of research.
To correct one part of your question, while the atmosphere is something like 78-ish% nitrogen and 1% "other elements, the only part of the atmosphere we need and actually use in breathing is the oxygen.
We "only" use 25-35% of the oxygen in any particular breath we take. That's 25-35% of the 21% of the oxygen in the air. So, of the roughly 12,000+ litres of air we breathe every day, we actually consume between 600 and 900 litres of oxygen.
Having said that, the NIH has stated quite bluntly that "Plant-based life support systems represent the only potential for self sufficiency and food production in an extra-terrestrial habitat."
Coincidentally, it also represents the only potential for self-sufficiency and food production on a terrestrial habitat, as well! [;)
Note that it says for an "extra-terrestrial habitat". On Earth it requires 8 or 9 trees to produce enough oxygen to support one person. For a reasonably-sized crew that's a lot of vegetation to be propelling through space in a spacecraft for the purpose of oxygen production.
But there are other ways of of providing oxygen.
We need to have quite a bit of water on the vessel anyway for many purposes, but the main reasons are as a radiation shield as well as a heat sink. Oxygen can be easily electrolysized from that water when topping up is required. You would count on this and make sure that you have enough water on board to account for that need.
The biggest problem with breathing oxygen is the exhalation of carbon dioxide. Humans begin to fare poorly when concentrations begin to exceed 5%. Removing the carbon dioxide is easy, but you have to keep on removing the CO2 throughout the entire flight/mission, then you potentially have to do something with that removed carbon dioxide, and you still need to replace the oxygen which the humans are removing through breathing.
Rather than jettisoning chemical cans every few 100,000km,there are some technological, non-organic methods of separating oxygen from the carbon in carbon dioxide. Intense UV seems to be a proven method.
So; impossible? Far from it.
On a space station or space habitat you use plants, which you also employ in the production of food and the purification of waste water which may include the use of algae and/or phytoplankton. On spacecraft you have compressed or liquefied O2 as backup but primarily convert CO2 back into oxygen, topping up from water stores. That's not to say that you couldn't or wouldn't have some kind of hydroponic shrubbery, but the primary purpose would be as a kitchen garden, not the production of oxygen.
Hope this helps.