09-30-2012
Quote:
Originally Posted by
Corona688
If you've deleted the file, then you have to kill whatever process has it open to close and remove it from disk.
If you hadn't deleted the file, you could've simply truncated it -- overwritten it with an empty file -- to reduce its size to zero.
Not necessarily.
It would depend on how the file is being written to by the process(es) that are writing to the file, and the file system in use.
If the file is being written to in append mode, truncating the file out from under the process(es) will probably work to reduce its size permanently.
If it's not being written to in append mode, after you truncate it down from, say, 10 GB to zero, the next time the process(es) write to the file, they'll still do so at the old 10 GB file offset. What happens then depends on whether or not the underlying file system supports sparse files.
And that's just if you're doing it all on a single machine. If it's a shared file (NFS, some other shared file system), things can get really fun.
10 More Discussions You Might Find Interesting
1. HP-UX
Hi All,
one of the mount point in Hp ux server has reached 95%
its a data base file and can not be deleted.
so i want to know how to increase the size of mount point
i am new to unix ,please help me (1 Reply)
Discussion started by: jyoti
1 Replies
2. UNIX for Dummies Questions & Answers
Hi..
I want to increase the file system size of any filesystem online, without using the Volume manager like LVMs, is it possible? & if yes then how? (3 Replies)
Discussion started by: Amol21
3 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
Could anybody tell me how to increase/decrease a process size in UNIX HP machine ? Whether the process size limitation will cause core dump ?
Thanks,
Rohit.. (1 Reply)
Discussion started by: ronix007
1 Replies
4. Solaris
Dear all,
I am very new to solaris,
I have installed solaris 10,
i tried installing few softwares into file system, unfortunately system failed to install stating "No space left on device "
i searched few threads and it says, we have to increase root size. where my root size is... (2 Replies)
Discussion started by: radhnki
2 Replies
5. UNIX for Dummies Questions & Answers
Unix protect its password by using salt
It that mean larger the salt size the more secure?
if the salt size increase greatly, will the password still able to be cracked?
thank you for helping (1 Reply)
Discussion started by: cryogen
1 Replies
6. AIX
Hello,
I am working AIX VIO server and extended Virtual Disk of one of the Partition with 10GB. After starting partition, i am not able to see increased size of disk.
Can you please help me what I need to do to increase the size of virtual disk from partition?
Thanks
Kishor
... (7 Replies)
Discussion started by: kishorbhede
7 Replies
7. UNIX for Dummies Questions & Answers
hi guys
I am working on my vmware workstation.
I have a /dev/sdb which is 5GB. I am using LVM.
Now I increase /dev/sdb 2 more GB.
fdisk -l shows 7 GB but pvscan still shows 5GB.
how do I make my system recognize the new 7GB added and be able to add those to my physical volumen and... (1 Reply)
Discussion started by: kopper
1 Replies
8. What is on Your Mind?
Any suggestions on how to increase the number of posters and contributors? Please vote and write in your suggestions.
Thank you! (72 Replies)
Discussion started by: Neo
72 Replies
9. SCO
Hi,
I'm Linux administrator who happens to 'administer' SCO Unix 5.0.7, which is virtual server on VMware - deployed from official ovf image.
My problem is that root filesystem is almost out of disk space, and we've decided to do it as we do on every other virtual servers and extend disk on... (13 Replies)
Discussion started by: goldenboy
13 Replies
10. Solaris
Host System: SPARC S7-2 Server; 2x8-core CPUs; 128Gb RAM; 2x600Gb HDD. running Solaris 11.3.
Last login: Tue Sep 19 14:42:42 2017 from xxx.xxx.xxx
Oracle Corporation SunOS 5.11 11.3 June 2017
$ uname -a
SunOS sog01 5.11 11.3 sun4v sparc sun4v
$
Original physical systems: Sun... (0 Replies)
Discussion started by: apmcd47
0 Replies
LEARN ABOUT HPUX
truncate
truncate(2) System Calls Manual truncate(2)
NAME
ftruncate, truncate - truncate a file to a specified length
SYNOPSIS
DESCRIPTION
The function causes the regular file referenced by fildes to have a size of length bytes.
The function causes the regular file named by path to have a size of length bytes.
The effect of and on other types of files is unspecified. If the file previously was larger than length, the extra data is lost. If it was
previously shorter than length, bytes between the old and new lengths are read as zeroes. With the file must be open for writing; for the
process must have write permission for the file.
If the request would cause the file size to exceed the soft file size limit for the process, the request will fail and the implementation
will generate the signal for the process.
These functions do not modify the file offset for any open file descriptions associated with the file. On successful completion, if the
file size is changed, these functions will mark for update the st_ctime and st_mtime fields of the file, and if the file is a regular file,
the and bits of the file mode may be cleared.
RETURN VALUE
Upon successful completion, returns 0. Otherwise a -1 is returned, and is set to indicate the error.
ERRORS
If or fails, is set to one of the following values:
A signal was caught during execution.
The length argument was less than 0.
[EFBIG] or [EINVAL] The length argument was greater than the maximum file size.
An I/O error occurred while reading from or writing to a file system.
Enforcement mode file/record locking is set (see
chmod(2)), and there are outstanding record locks on the file with the or system calls.
If fails, is set to one of the following values:
[EBADF] or [EINVAL] The fildes argument is not a file descriptor open for writing.
The user's disk quota block limit has been reached for this file system.
The fildes argument references a file that was opened without write permission.
If fails, is set to one of the following values:
A component of the path prefix denies search permission, or write permission is denied on the file.
The user's disk quota block limit has been reached for this file system.
path points outside the process's allocated address space. The reliable detection of this error is implementation
dependent.
The named file is a directory.
Too many symbolic links were encountered in resolving
path.
Pathname resolution produced an intermediate result
whose length exceeds bytes, or the length of a component of the pathname exceeds bytes.
A component of does not name an existing file or path is an empty string.
A component of the path prefix of path is not a directory.
The named file resides on a read-only file system.
The file is a pure procedure (shared text) file that is being executed.
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO
chmod(2), fcntl(2), flock(2), ftruncate64(2), lockf(2), open(2), truncate64(2), privileges(5), <unistd.h>.
CHANGE HISTORY
First released in Issue 4, Version 2.
STANDARDS CONFORMANCE
truncate(): AES ftruncate(): AES, SVID3
truncate(2)