IBM FlashSystem

IBM FlashSystem

Find answers and share expertise on IBM FlashSystem


#Storage
Ā View Only

AIX SCSI unmap SVC 8.5.X

By Tomas Kovacik posted 2 days ago

  

When using thin provisioned volumes and deleting a file from the file system, operating system will not physically free space on the disk array. It only reduces the number of link counts on the relevant file without physical data deletion. This means that the file was deleted but the space was not freed.

 

Possibilities how to physically freeing up space in the SVC pool are:

 

- rm file ; dd if=/dev/zero bs=1M coutn=X of=file 

  does not use SCSI UNMAP just brute force

  

- rm file ; chfs -a reclaim=normal|fast /FS

SCSI UNMAP  in use, we don't need to  physically overwrite the entire file or FS , and we can free up space even from a file where only part of it is unused

 

- addvdisccopy on affected vdisk (which will return allocated extents as we can see later) 



Let's take a look at what happens on the OS and what on the disk array

We have 8.5 SVC version , there are some automation on 8.6 but the principle is the same,  AIX version was 7300-02-02-2420

#ENV CREATION 

 

#SVC - part (1GB exten size)  

chsystem -hostunmap on

mkvdisk -mdiskgrp stg_flash -iogrp 1 -nofmtdisk -cache readwrite -vtype striped -size 10 -unit gb -rsize 1 -autoexpand -name zmazma10

mkvdiskhostmap -host sktom73v_1 zmazma10

 

#AIX - part 

mkvg -S -y vg_unmap -s 64 hdisk1

mklv -y lvunmap -t jfs2 vg_unmap 158

crfs -v jfs2 -d lvunmap -m /unmap -A yes -p rw -a agblksize=4096 -a logname=INLINE -a options=cio

mount /unmap

 

#SVC - occupied capacity 

lsvdisk zmazma10 | grep -w -E "used_capacity|real_capacity|free_capacity”;lsvdiskextent zmazma10

used_capacity 131.25MB

real_capacity 145.00MB

free_capacity 13.75MB

id number_extents

60 1             

analyzevdisk zmazma10;while :; do OOO=$(lsvdiskanalysisprogress -nohdr | cut -d " " -f2); [ $OOO -eq 0 ] && break; done;lsvdiskanalysis zmazma10 | grep thin_size

 

thin_size 0.00MB

 

# 1GB written 

dd if=/tmp/1Gfile bs=1M of=/unmap/1Gfile

lsvdisk zmazma10  | grep -w  -E "used_capacity|real_capacity|free_capacity";lsvdiskextent zmazma10

used_capacity 1.07GB

real_capacity 1.08GB

free_capacity 11.50MB

id number_extents

60 1             

61 1             

analyzevdisk zmazma10;while :; do OOO=$(lsvdiskanalysisprogress -nohdr | cut -d " " -f2); [ $OOO -eq 0 ] && break; done;lsvdiskanalysis zmazma10 | grep thin_size

 

thin_size 1.07GB

 

# 2GB

dd if=/tmp/1Gfile bs=1M of=/unmap/1Gfile_1 

used_capacity 2.07GB

real_capacity 2.08GB

free_capacity 11.00MB

id number_extents

60 1             

61 1             

70 1 

 

thin_size 2.12GB

 

# 10GB

df -g /unmap

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

/dev/lvunmap       9.88      0.00  100%       14    44% /unmap

used_capacity 9.88GB

real_capacity 9.89GB

free_capacity 12.50MB

id number_extents

53 1             

54 1             

60 2             

61 2             

66 1             

70 2             

71 1          

 

thin_size 9.87GB

We can see how extens allocation works when FS is graddually filled  

1) reclaim=NORMAL

for i in 1 2 3 4 5 6 7 8 9 10

do

  dd if=/tmp/1Gfile bs=1M of=/unmap/1Gfile_${i} &

done

df -g /unmap
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/lvunmap       9.88      0.00  100%       13    41% /unmap

rm /unmap/*

df -g /unmap
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/lvunmap       9.88      9.83    1%        3     1% /unmap

filemon -o /tmp/filemon.out -O lv,pv,detailed -T 500000 ;chfs -a reclaim=normal /unmap;trcstop

Run trcstop command to signal end of trace.
Wed Dec  3 15:48:23 2025
System: AIX 7.3 Node: sktom73v Machine: 00FC00E34B00
[filemon: Reporting started]
[filemon: Reporting completed]

[filemon: 9.444 secs in measured interval]


lvmstat -v vg_unmap -r
PV_name     reclaim Mb_freed    Mb_pending  Mb_success  Mb_failed   Mb_reused
hdisk1      on      114432      0           114432      0           0  

grep -p "VOLUME: /dev/lvunmap" /tmp/filemon.out
VOLUME: /dev/lvunmap  description: /unmap
reads:                  2       (0 errs)
  read sizes (blks):    avg     8.0 min       8 max       8 sdev     0.0
  read times (msec):    avg   0.456 min   0.393 max   0.518 sdev   0.062
  read sequences:       2
  read seq. lengths:    avg     8.0 min       8 max       8 sdev     0.0
writes:                 5       (0 errs)
  write sizes (blks):   avg     8.0 min       8 max       8 sdev     0.0
  write times (msec):   avg   1.324 min   0.335 max   4.564 sdev   1.625
  write sequences:      5
  write seq. lengths:   avg     8.0 min       8 max       8 sdev     0.0
seeks:                  7       (100.0%)
  seek dist (blks):     init     64,
                        avg 3444136.0 min       8 max 20659336 sdev 7698871.6
time to next req(msec): avg  11.149 min   0.002 max  44.323 sdev  16.254
throughput:             3.0 KB/sec
utilization:            0.00

lsvdisk zmazma10  | grep -w  -E "used_capacity|real_capacity|free_capacity";lsvdiskextent zmazma10
used_capacity 9.88GB
real_capacity 9.89GB
free_capacity 12.50MB
id number_extents 
47 1              
48 1              
49 1              
50 1              
51 1              
52 1              
53 1              
54 1              
60 1              
61 1

analyzevdisk zmazma10;while :; do OOO=$(lsvdiskanalysisprogress -nohdr | cut -d " " -f2); [ $OOO -eq 0 ] && break; done;lsvdiskanalysis zmazma10 | grep thin_size

thin_size 0.00MB

We can see that all 10 extents are still allocated but analyzevdisk already shows that the fs is empty

addvdiskcopy -mdiskgrp stg_flash  -syncrate 150 -rsize 1 -autoexpand -autodelete zmazma10

lsvdisk zmazma10  | grep -w  -E "used_capacity|real_capacity|free_capacity";lsvdiskextent zmazma10
used_capacity 131.25MB
real_capacity 145.00MB
free_capacity 13.75MB
id number_extents 
60 1

After addvdiskcopy we can see that extents were released back to the pool    

2) reclaim=FAST

for i in 1 2 3 4 5 6 7 8 9 10

do

  dd if=/tmp/1Gfile bs=1M of=/unmap/1Gfile_${i} &

done

df -g /unmap
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/lvunmap       9.88      0.00  100%       13    41% /unmap

rm /unmap/* 

df -g /unmap
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/lvunmap       9.88      9.83    1%        3     1% /unmap

filemon -o /tmp/filemon.out -O lv,pv,detailed -T 500000 ;chfs -a reclaim=fast /unmap;trcstop  

Run trcstop command to signal end of trace.
Wed Dec  3 16:16:18 2025
System: AIX 7.3 Node: sktom73v Machine: 00FC00E34B00

[filemon: Reporting started]
[filemon: Reporting completed]

[filemon: 5.332 secs in measured interval]

lvmstat -v vg_unmap -r
PV_name     reclaim Mb_freed    Mb_pending  Mb_success  Mb_failed   Mb_reused
hdisk1      on      118528      0           118528      0           0    

grep -p "VOLUME: /dev/lvunmap" /tmp/filemon.out
VOLUME: /dev/lvunmap  description: /unmap
reads:                  2       (0 errs)
  read sizes (blks):    avg     8.0 min       8 max       8 sdev     0.0
  read times (msec):    avg   2.296 min   0.302 max   4.290 sdev   1.994
  read sequences:       2
  read seq. lengths:    avg     8.0 min       8 max       8 sdev     0.0
writes:                 5       (0 errs)
  write sizes (blks):   avg     8.0 min       8 max       8 sdev     0.0
  write times (msec):   avg   0.471 min   0.323 max   0.751 sdev   0.146
  write sequences:      5
  write seq. lengths:   avg     8.0 min       8 max       8 sdev     0.0
seeks:                  7       (100.0%)
  seek dist (blks):     init     64,
                        avg 3444250.7 min       8 max 20660024 sdev 7699128.0
time to next req(msec): avg  14.282 min   0.000 max  56.163 sdev  21.182
throughput:             5.3 KB/sec
utilization:            0.00

lsvdisk zmazma10  | grep -w  -E "used_capacity|real_capacity|free_capacity";lsvdiskextent zmazma10
used_capacity 9.88GB
real_capacity 9.89GB
free_capacity 12.50MB
id number_extents 
0  1              
17 1              
40 1              
41 1              
42 1              
43 1              
44 1              
45 1              
60 1              
71 1              

analyzevdisk zmazma10;while :; do OOO=$(lsvdiskanalysisprogress -nohdr | cut -d " " -f2); [ $OOO -eq 0 ] && break; done;lsvdiskanalysis zmazma10 | grep thin_size

thin_size 5.72GB

addvdiskcopy -mdiskgrp stg_flash  -syncrate 150 -rsize 1 -autoexpand -autodelete zmazma10

lsvdisk zmazma10  | grep -w  -E "used_capacity|real_capacity|free_capacity";lsvdiskextent zmazma10
used_capacity 5.88GB
real_capacity 5.89GB
free_capacity 13.25MB
id number_extents 
47 1              
48 1              
49 1              
50 1              
51 1              
52 1

             

#CONCLUSION 

In both cases normal,fast we can see the some FS activity (filemon) 2 read , 5 writes which means 2 x 8 blocks x 512B = 8KB read read 20 KB write. Normal operation took 9.44s fast 5.33s.As you can see from attached picture unmap operations caused max unmap data rate on SVC 120MB/s for normal and 68 MB/s for fast option

but crutial point is that fast option was not able to release all allocated volume space and 5.72GB was still occupied which means 6 extents allocation   

   

0 comments
32 views

Permalink