gboudreau edited this page Jun 30, 2012 · 9 revisions

Suggested Storage Selection Algorithm Usage

Here's a suggested configuration for drive_selection_algorithm.

This will categorize all your storage pool drives into four categories, and will sequentially use the drives with the most available space in each category when creating file copies.

Example configuration:

drive_selection_groups = OK: /mnt/hdd0/gh, /mnt/hdd2/gh
                       NEW: /mnt/hdd1/gh
                       BROKEN: /mnt/hdd3/gh
                       REMOTE: /mnt/remote1/gh

drive_selection_algorithm = forced (1xOK, 1xNEW, 1xBROKEN, 1xREMOTE) most_available_space
  • On a share with num_copies=1, the file copy will go on either hdd0 or hdd2, whichever has the most available space.
    If those two drives are full (free space < min_free), then another drive with available space will be picked from hdd1, hdd3 or remote1 (in that order). If all drives are below min_free, then either hdd0 or hdd2 will be used, if they have enough free space (free space > file size).

  • On a share with num_copies=2, the first file copy will go on the drive selected with the above algorithm (normally hdd0 or hdd2), and the second copy will go on hdd1 (again, only if it's not full).

  • On a share with num_copies=3, the first file copy will go on hdd0/hdd2, the second on hdd1, and the third on hdd3.

  • On a share with num_copies=4, the first file copy will go on hdd0/hdd2, the second on hdd1, the third on hdd3, and the fourth on remote1.

  • On a share with num_copies=5, the first file copy will go on hdd0/hdd2, the second on hdd1, the third on hdd3, the fourth on remote1, and the fifth on hdd2/hdd0 (depending on which one wasn't used for the first copy).


  • OK: Drives that you have been using for a while (with or without Greyhole). Those drives should normally perform as expected, and stay healthy a long time.
    Those drives will be used first when adding files into your storage pool.

  • NEW: Drives that you just added into your storage pool.
    Hard drives often fail early in their life, making new drives somewhat more dangerous to use for your important files.
    Those drives will be used for extra file copies only, unless all OK drives are full.

  • BROKEN: Drives that are still somewhat functional, but that showed signs of deterioration. Maybe they start having bad sectors, or disappear-reappear for no reason, or... When this happens, you should unmount the drive, and check it (with e2fsck -cfp, or similar) before re-mounting it.
    Those drives will only be used for extra file copies when other copies exists in OK and NEW drives, or when those are all full.

  • REMOTE: Drives that are remote mounts. (An Airport-attached USB drive mounted locally using afpfs-ng for example.)
    Those drives will be used last for extra file copies. You probably want only file on shares with num_copies=max to go there.