This article has been archived and is no longer updated by Apple.

Xsan: Ensuring that files or folders go to the intended affinities

In order to force a file to relocate to the storage pool(s) specified by a folder's affinity, the file must be physically copied or re-written, not copied via the Finder or via a mv command.

Affinities control what data is written to which storage pool(s). This allows administrators to assign affinities to storage pool(s) that force users, through permissions, to write data to specific pools. These pools are generally configured to be composed of similar LUN types. Administrators set up storage pools with different balances of performance and redundancy, such as RAID 0 and RAID 5.

When you use the Finder or the mv command to move a file from one folder to another folder on the same volume, the data is not actually copied. Instead, only the new and old folders are changed to reflect the new location of the file (this is called a rename operation). Because the file data itself is not actually moved, this can cause unintended behavior when the new and old folders have different, or no affinities.

Copying a file

In the Finder, Option-drag the file into the desired folder with affinity to copy the file. Alternatively, you can use a command line tool such as ditto or cvcp to copy the file. See the man pages for more information and options.

If desired, delete the original once the copy has been verified as good.

Rewriting a file

Use the

snfsdefrag

command. The snfsdefrag command can rewrite the file on to the affinity's storage pool(s). Using the snfsdefrag command will rewrite the file without changing the path to the file. See man snfsdefrag for more information and options.

Example of a file rewrite

A storage pool(s) has an affinity of Fast. You want to move a file named "moveme" onto this storage pool(s). The Xsan volume is named MyVolume and the source file ("moveme") is located inside folder1.

The command would be:

sudo snfsdefrag -k Fast -m 0 /Volumes/MyVolume/folder1/moveme

If you are unsure if a file or folder resides within an affinity

If you are unsure if a file or folder resides within an affinity, run the cvaffinity command on the file and folder.

cvaffinity -l <path to folder> cvaffinity -l <path to file>

Note: the -l is a lower case letter L (for list). (See man cvaffinity for more information and options.)

Two example commands followed by italicizedsample output:

cvaffinity -l /Volumes/MyVolume/folder1/Volumes/MyVolume/folder1: Fast (0x7265766f7473) cvaffinity -l /Volumes/MyVolume/folder1/moveme /Volumes/MyVolume/folder1/moveme: Fast (0x7265766f7473)

In these examples, both the folder and the file have the same affinity, Fast, and are on the same storage pool, (0x7265766f7473).

Note: Depending on the method used, the file(s) POSIX and or ACL entries may need to be reset.

Learn more

For more information about affinities, see the Xsan Admin Guide.

For more information about POSIX and Access Control Lists, see the MacOS X Server administration guides:

Published Date: