Evicting files or objects data

Complete the following steps to evict data from files or objects:

  1. To create an AFM to cloud object storage relation, issue the following command:
    mmafmcosconfig fs1 afmtocos1 --endpoint http://IP --uid 0 --gid 0 --new-bucket afmtocos1 --mode sw --object-fs --cleanup
    afmobjfs=fs1 fileset=afmtocos1
    bucket=afmtocos1 newbucket=afmtocos1 objectfs=yes dir=
    policy= tmpdir= tmpfile= cleanup=yes mode=sw
    xattr=no ssl=no acls=no gcs=no vhb=
    bucketName=afmtocos1 serverName=IP
    Linkpath=/gpfs/fs1/afmtocos1 target=http://IP/afmtocos1
    endpoint=--endpoint http://IP
    XOPT= -p afmObjectSubdir=yes -p afmParallelWriteChunkSize=0 -p afmParallelReadChunkSize=0
    rc=0 mmdsh -vN c7f2n05 /usr/lpp/mmfs/bin/mmafmtransfer -v -t -a key -s key -b afmtocos1 -e http://IP bcreate
  2. Create objects or files in the afmtocos1 fileset.
    for a in `seq 10`; do dd if=/dev/urandom of=/gpfs/fs1/afmtocos1/object$a count=8 bs=256K & done
    1. To get the contents of the fileset, issue the following command:
      ls -lsh /gpfs/fs1/afmtocos1/
      A sample output is as follows:
      total 20M
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object1
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object10
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object2
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object3
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object4
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object5
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object6
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object7
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object8
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object9
      Note: The space consumed is 20M, that is, each object is consuming 2 Mb.
    2. To check the disk usage, issue the following command:
      du -sh /gpfs/fs1/afmtocos1/
      A sample output is as follows:
      20M /gpfs/fs1/afmtocos1/
  3. Evict an evict file that contains a list of files for the data eviction.
    1. To get the list of files an evict file, issue the following command:
      cat /root/evictfile
      A sample output is as follows:
      /gpfs/fs1/afmtocos1/object1
      /gpfs/fs1/afmtocos1/object2
      /gpfs/fs1/afmtocos1/object3
      /gpfs/fs1/afmtocos1/object4
      /gpfs/fs1/afmtocos1/object5
    2. To evict files or objects, issue the following command:
      mmafmcosctl fs1 afmtocos1 /gpfs/fs1/afmtocos1/ evict --object-list /root/evictfile
  4. To check evicted data blocks and the disk size, issue the following command:
    ls -lsh /gpfs/fs1/afmtocos1/
    A sample output is as follows:
    total 10M
    0    -rw-r--r-- 1 root root 2.0M Sep 10 2020 object1
    2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object10
    0    -rw-r--r-- 1 root root 2.0M Sep 10 2020 object2
    0    -rw-r--r-- 1 root root 2.0M Sep 10 2020 object3
    0    -rw-r--r-- 1 root root 2.0M Sep 10 2020 object4
    0    -rw-r--r-- 1 root root 2.0M Sep 10 2020 object5
    2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object6
    2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object7
    2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object8
    2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object9
    The ls command shows that evicted data blocks and the disk size is 0 for object1 through object5.
  5. To check the disk usage, issue the following command:
    du -sh /gpfs/fs1/afmtocos1/
    A sample output is as follows:
    10M /gpfs/fs1/afmtocos1/
    Now the disk space is 10M because other 10M is evicted from five objects.
  6. Bring back objects and files from a cloud object storage.
    1. Issue to the following command:
      cd /gpfs/fs1/afmtocos1/
    2. To get the contents of the fileset, issue the following command:
      cat object1 object2 object3 object4 object5 > /dev/null
    3. To check the cache state, issue the following command:
      mmafmctl  fs1 getstate
      A sample output is as follows:
      Fileset Name Fileset Target                   Cache State    Gateway Node  Queue Length Queue numExec
      ------------ -------------------------------- -------------  ------------  ------------ -------------
      afmtocos1  http://IP:80/afmtocos1 Active        c7f2n05        0            36
      
    4. To get the contents of the fileset, issue the following command:
      ls -lsh /gpfs/fs1/afmtocos1/
      A sample output is as follows:
      total 20M
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object1
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object10
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object2
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object3
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object4
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object5
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object6
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object7
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object8
      2.0M -rw-r--r-- 1 root root 2.0M Sep 10 2020 object9
    5. To check the disk usage, issue the following command:
      du -sh /gpfs/fs1/afmtocos1/
      A sample output is as follows:
      20M /gpfs/fs1/afmtocos1/
    Now the used disk space is again 20Mb. This output shows that files are read and data is brought back from the cloud object storage.