The ability to modify chemical bonding in dense heterogeneous solid mixtures by applying high pressure and temperature opens new opportunities to develop a greater number of novel materials with controlled structure, stability and exceptional physical properties. Here, we present the transformation of highly strained CO2-III (Cmca) filled in porous low-density carbons (LDC) to extended CO2-V (I-42d) encapsulated in porous diamond (Fd-3m) at high pressures and temperatures. The x-ray diffraction data indicates the density of porous diamond is about 5%-8% lower than that of bulk diamond and undergoes the structural distortion to monoclinic diamond (C2/m or M-carbon) upon pressure unloading. This result, therefore, demonstrates a feasibility to use porous LDC as nm-scale reactors to synthesize and store carbon dioxide and other high energy density extended solids.