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
# 8  
Old 03-27-2014
Quote:
Originally Posted by jlliagre
Truncating the unlinked file will certainly work with ZFS too.
Truncating an open file is not guaranteed to work. The mode the file descriptor is in matters, as does the ability of the underlying file system to support sparse files. If the mode is "wrong", and I think "wrong" can depend on a lot of things, but in this case I think if the file wasn't opened with O_APPEND flag set is what's most important, the next time the process that has the file open writes to the file, the data will go to whatever the current file offset is for that open file descriptor. If the underlying file system doesn't support sparse files, and the current offset is 6 GB into the file, now that file you truncated is suddenly once again 6 GB in size.

In short, if the file is created like this:

Code:
daemon.process >> log.file

You should be OK if you truncate that log file.

If it's

Code:
daemon.process > log.file

You can't be sure that truncating log file will stick.

This isn't really a simple issue - the specific OS matters, the specific file system matters, the specific flags set on the open file descriptor matter, and the actions the process performs on the open file descriptor matter.

Try it:

Code:
cat /dev/null >> /some/file &

Let the file grow to a good size, then

Code:
cp /dev/null /some/file

Now try

Code:
cat /dev/null > /some/file

This User Gave Thanks to achenle For This Post:
# 9  
Old 03-28-2014
Quote:
Originally Posted by achenle
Truncating an open file is not guaranteed to work.
Truncating the file is guaranteed to work, i.e. to release the disk space, in the OP context. The question clearly mention the underlying file system is ZFS. In any case, all file systems supported on Solaris support sparse files outside FAT32.
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