ZFS does not release space even after deleting application log files in a non-global zone


 
Thread Tools Search this Thread
Operating Systems Solaris ZFS does not release space even after deleting application log files in a non-global zone
# 1  
Old 03-25-2014
ZFS does not release space even after deleting application log files in a non-global zone

Hi Guys,

I have a non-global zone in which has apache application on it. There is a ZFS filesystem where the app saves the log. Even after deleting the logfiles I dont see the space being freed up. There are no snapshots or anything at all

Code:
Zpool info
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
adpl203 9.94G 9.75G 190M 98% ONLINE -

ZFS info
NAME USED AVAIL REFER MOUNTPOINT
adpl203 9.75G 31.4M 31K /adpl203
adpl203/data 9.75G 31.4M 31K /adpl203/data
adpl203/data/ajb_home 9.75G 31.4M 9.75G /export/home/ajb

zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
adpl203 29.7M 9.75G 0 31K 0 9.75G
adpl203/data 29.7M 9.75G 0 31K 0 9.75G
adpl203/data/ajb_home 29.7M 9.75G 0 9.75G 0 0

df -h 

adpl203/data 9.8G 31K 31M 1% /adpl203/data
adpl203/data/ajb_home 9.8G 9.8G 31M 100% /export/home/ajb

Can anyone please help me find a solution!

Last edited by radoulov; 04-03-2014 at 12:20 PM..
# 2  
Old 03-25-2014
The log files are likely still open by apache, thus even unlinked, their data is still stored on the file system. This would happen with other file systems than ZFS. You should have blanked their content before removing them, as with:

Code:
> apache.log
rm apache.log

# 3  
Old 03-25-2014
If that's the case, bouncing Apache should free the space.
# 4  
Old 03-25-2014
Thanks for responding @jlliagre and @radoulov (bouncing apache or unmounting and mounting zfs fs are last options for me)...

I usually truncate the file after making a copy, but someone before me deleted the file directly. Now, when I do du -skh /export/home/ajb it shows around 70M but df and zfs list shows about 9.7g which is 100%. I have seen this discrepancy between du and df in UFS for which I use the following solution
Sorry it wont let me post a link to the source, for the source please google for
Discrepancies Between df And du Outputs
Code:
1. Find the file which has been unlinked through the procfs interface

# find /proc/*/fd \( -type f -a ! -size 0 -a -links 0 \) -print | xargs \ls -li
 415975 --w-------   0 user  group  2125803025 Oct 15 23:59 /proc/1252/fd/3


2. Eventually, get more detail about it:

  1252

3.Check to see if you can understand what is the content of the unlinked file:
# tail /proc/1252/fd/3
-------------------------------------------------------------------------------
2008-10-15 23:59:32.002116 - [MSG] BBG_Transmitter_class.cc, line 792 (thread 25087:4)
[4060] Sent a heartbeat
-------------------------------------------------------------------------------
BBG_Transmitter_class.cc: [4111] No activity detected. Send a Heartbeat message
-------------------------------------------------------------------------------
2008-10-15 23:59:32.134829 - [MSG] BBG_Transmitter_class.cc, line 1138 (thread 25087:4)
[4065] Heartbeat acknowledged by Bloomberg

4.You can correlate the size of the removed, but always referenced, file to the space accounted from the du and df tools:
# df -k /path/to
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/md/dsk/d5       6017990 5874592   83219    99%    /path/to
# du -sk /path/to
3791632 /data
# echo "(5874616-3791632)*1024" | bc
2132975616

5. So, we now found the ~2GB log file which was always opened (used) by a process. Now, there are two solutions to be able to get back the freed space:
Truncate the unlinked file (quick workaround).
Simply restart properly the corresponding program (better option).

But I don't know if that'll work for a zfs filesystem.... Do you know any procedure like the one above where I can truncate the links which are holding up the space?
# 5  
Old 03-25-2014
Well, as always - it depends, but a graceful restart of Apache usually has a limited impact.
This User Gave Thanks to radoulov For This Post:
# 6  
Old 03-25-2014
Truncating the unlinked file will certainly work with ZFS too.
These 2 Users Gave Thanks to jlliagre For This Post:
# 7  
Old 03-25-2014
Thanks for the input guys, we went the safest route by bouncing Apache and it cleared the issue. Regarding truncating linked file, I will keep that in mind and try it next time.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Solaris 11 zone has no external network access (except to Global Zone)

Hi, hoping someone can help, its been a while since I used Solaris. After creating a NGZ (non global zone), the NGZ can access the GZ (Global Zone) and the GZ can access the NGZ (using ssh, zlogin) However, the NGZ cannot access any other netwqork devices, it can't even see the default router ... (2 Replies)
Discussion started by: GazinLincoln
2 Replies

2. Solaris

Date and time change in global and non global zone

Hi, If I change date and time in global zone, then it will affect in non global zones. During this process what files will get affect in non global zones and which mechanism it's using to change. gloabl zone:Solaris 11.3 X86 TIA (1 Reply)
Discussion started by: Sumanthsv
1 Replies

3. Solaris

Global and non-global zone resource sharing - tricky

hi all, Just a simple question but i cant get the answers in the book - In my globalzone , assuming i have 4 cpus (psrinfo -pv = 0-3), if i set dedicated-cpu (ncpus=2) for my local zone Is my globalzone left with 2 cpus or still 4 cpus ? Does localzone "resource reservation.e.g. cpu in... (6 Replies)
Discussion started by: javanoob
6 Replies

4. Solaris

showing 2 different time zones in global zone and nonglobal zone

can some one help me out as it is showing 2 different time zones in global zone and nonglobal zone .In global zone it is showing in GMT while in nonglobal zone i it showing as PDT. System in running with solaris 10 (3 Replies)
Discussion started by: ravijanjanam12
3 Replies

5. Solaris

ZFS adding new filesystems to a non-global zone

Hi Guys I have one Global Zone and 2 non-global zones. root@solar109 # zoneadm list -icv ID NAME STATUS PATH BRAND IP 0 global running / native shared 20 solar109b running ... (1 Reply)
Discussion started by: fryzh
1 Replies

6. Solaris

how to add a default gateway in a zone of different VLAN of global zone

Hi Greetings... I have an issue in connecting the zone from outside the network and it is because of default gateway. I can ping default gateway from inside the zone and not able to ping from global zone due to different VLAN issue. If i add two different gateways and restart network services,... (2 Replies)
Discussion started by: vvpotugunta
2 Replies

7. Solaris

Accessing global-zone installed application

Hi, Is it possible to access application installed on global-zone from a non-global zone? Is there any configuration to achieve the above requirement? Tried looking up information but unable to find. Thanks in advance. Eugene (3 Replies)
Discussion started by: srage
3 Replies

8. Solaris

How to access ENV variables of non global zones in global zone???

Hi Guys, My requirement is I have file called /opt/orahome/.profile in non global zone. PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:. export PATH PS1="\${ORACLE_SID}:`hostname`:\$PWD$ " export PS1 EDITOR=vi export EDITOR ENV=/opt/orahome/.kshrc export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies

9. Solaris

[b]How to mount a folder from global zone to non global zone??

Hi All There is one folder in global zone I just want to share the same folder innon global zone. How can i do it? pls send me script for this. (2 Replies)
Discussion started by: vijaysachin
2 Replies
Login or Register to Ask a Question