A method of deleting obsolete files from a file system in a distributed storage system including a plurality of computer servers and plurality of storage devices, the method comprising: at a computer server, from the plurality of computer servers, including one or more processors and memory: maintaining a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names, each target file name representing a target file in the file system associated with a storage device that includes content data, and each reference file name representing one reference from a client to a corresponding target file; receiving a request to delete a reference to a first target file in the file system; identifying a first reference file name in the file reference data structure, wherein the first reference file name includes the file name of the first target file in the file system; marking the first reference file name for deletion and deleting a first reference file from the file system associated with the identified first reference file name; checking, based on the file reference data structure, whether the file system includes at least one additional reference file whose file name matches the file name of the target file in the file system; if there is no such additional reference file in the file system: deleting the first target file from the file system; and deleting the first file name of the target file in the file system from the file reference data structure wherein the file reference data structure is in form of a data record stored in a database. at a computer server, from the plurality of computer servers, including one or more processors and memory: maintaining a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names, each target file name representing a target file in the file system associated with a storage device that includes content data, and each reference file name representing one reference from a client to a corresponding target file; receiving a request to delete a reference to a first target file in the file system; identifying a first reference file name in the file reference data structure, wherein the first reference file name includes the file name of the first target file in the file system; marking the first reference file name for deletion and deleting a first reference file from the file system associated with the identified first reference file name; checking, based on the file reference data structure, whether the file system includes at least one additional reference file whose file name matches the file name of the target file in the file system; if there is no such additional reference file in the file system: deleting the first target file from the file system; and deleting the first file name of the target file in the file system from the file reference data structure maintaining a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names, each target file name representing a target file in the file system associated with a storage device that includes content data, and each reference file name representing one reference from a client to a corresponding target file; receiving a request to delete a reference to a first target file in the file system; identifying a first reference file name in the file reference data structure, wherein the first reference file name includes the file name of the first target file in the file system; marking the first reference file name for deletion and deleting a first reference file from the file system associated with the identified first reference file name; checking, based on the file reference data structure, whether the file system includes at least one additional reference file whose file name matches the file name of the target file in the file system; if there is no such additional reference file in the file system: deleting the first target file from the file system; and deleting the first file name of the target file in the file system from the file reference data structure wherein the file reference data structure is in form of a data record stored in a database.