The chemical reactions and pathways involving glycosylphosphatidylinositol anchors, molecular mechanisms for attaching membrane proteins to the lipid bilayer of cell membranes. Structurally they consist of a molecule of phosphatidylinositol to which is linked, via the C-6 hydroxyl of the inositol, a carbohydrate chain. This chain is in turn linked to the protein through an ethanolamine phosphate group, the amino group of which is in amide linkage with the C-terminal carboxyl of the protein chain, the phosphate group being esterified to the C-6 hydroxyl of the terminal mannose of the core carbohydrate chain.