The technology of five-dimensional (5D) optical data storage in transparent materials paves a promising way to unlimited lifetime data storage for future cloud use. Phase-only liquid-crystal-on-silicon spatial light modulators (LCOS SLMs) have already exhibited its potential for this application in tailoring ultrafast laser writing beams for 5D optical data storage. A phase-only LCOS SLM can generate arbitrary data patterns by using diffractive holographic imaging for data writing light beam generation. However, the polarization control of the output holographic image is still achieved by using an external polarization modulator, which leads to complications, bulkiness, and large delays in current methods. In this paper, we presented an efficient phase and polarization modulation method through a compact system based on a single phase-only LCOS SLM to simultaneously control both the holographic image and its polarization state. The proposed method utilizes two-polarization-component coding in conjunction with a polarization component rotation technique in a compact system. Using this polarization rotation technique, two light components can be independently coded by separately using two holograms on two halves of the LCOS SLM. We experimentally construct a proof-of-concept prototype of the compact system, and the effectiveness of the system has been experimentally verified.