Sponsored Content
Full Discussion: Not able to delete log file
Operating Systems Solaris Not able to delete log file Post 302865195 by Don Cragun on Thursday 17th of October 2013 11:26:43 PM
Old 10-18-2013
The commands:
Code:
>soa.out
>admin.out

deallocate all blocks allocated to those files at that time, but it doesn't close the file descriptors and does not reset the file offset that determines the position in the file where the next data written will be placed by in the processes that are writing to those files.

The next time the process writes something to one of those files, it will write it to the spot in the file just after the last place it wrote into that file. That will not allocate any disk blocks for the bytes in the file you previously deallocated, so what you end up with is known as a holey file which contains unallocated blocks that have never been written. If you try to read data from those blocks (such as by running cat soa.out), those unallocated blocks will appear as though null bytes had been written into those bytes.

If you change the program(s) that are writing those log files to add the O_APPEND flag to the oflag argument to the call to open() that opens the log files, it will reset the position in the log file where it writes data to the current end of file every time it writes to the log file. So, if you clear the log file using >logfile, the next write to the log file will be at the start of the file instead of leaving a huge hole at the start of the file.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mass delete a certain string in a .log file

Hey all. I have a file that has roughly 115,000 lines in it. There are a few lines of information that I don't want in it, but I don't want to search through all of the lines to find the ones that I don't want. Is there a way to do a mass delete of the lines that I don't want? Thanks for the... (4 Replies)
Discussion started by: jalge2
4 Replies

2. Shell Programming and Scripting

how to delete blank rows in a log file

Help How to delete all blank rows in log file (4 Replies)
Discussion started by: suryanarayana
4 Replies

3. Shell Programming and Scripting

Delete lines prior to a specific date in a log file.

Hi all. I have a database log file in which log data get appended to it daily. I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date. How should i do it? Please help. Thanks. Example. To delete all lines prior to Jun... (4 Replies)
Discussion started by: ahSher
4 Replies

4. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

5. Shell Programming and Scripting

Log file - Delete lines

Hello, I tried to search on the site a way to delete lines on log files but I didn't find what I am looking for... I hope someone will be able to help me. I do not know how to explain this, so I will do my best. I have a log file and I want to delete all second lines. Example : ... (3 Replies)
Discussion started by: Aswex
3 Replies

6. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

7. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

8. Shell Programming and Scripting

Delete all files from the directory except the ones in the log file

I have a log file with contents like below. Repository: https://someserver:9443/ Workspace: (1000) "test_scripts_ws" Component: (1001) "some_Automated_Scripts" Change sets: (1002) ---$ john "test memory" 17-Sep-2014 02:24 PM Changes: --a--... (9 Replies)
Discussion started by: gaurav99
9 Replies

9. UNIX for Dummies Questions & Answers

Log file - Delete duplicate line & keep last date

Hello All ! I need your help on this case, I have a csv file with this: ITEM105;ARI FSR;2016-02-01 08:02;243 ITEM101;ARI FSR;2016-02-01 06:02;240 ITEM032;RNO TLE;2016-02-01 11:03;320 ITEM032;RNO TLE;2016-02-02 05:43;320 ITEM032;RNO TLE;2016-02-01 02:03;320 ITEM032;RNO... (2 Replies)
Discussion started by: vadim-bzh
2 Replies

10. UNIX for Beginners Questions & Answers

Delete from another file that matched on log file

I want to write a script using Oscam Cardsharing server this is my test: cat oscam.log | grep "error" sample output: 2018/10/17 16:43:07 5C94A12E p (cccam) cccam(r) test.dyndns.org: login failed, error Once I've found an error, I need to remove its information inside another file : ... (5 Replies)
Discussion started by: vzoli1987
5 Replies
fs_vxfs(4)						     Kernel Interfaces Manual							fs_vxfs(4)

NAME
fs_vxfs - format of a VxFS file system volume SYNOPSIS
DESCRIPTION
The VxFS super-block always begins at byte offset 8192 from the start of the file system. The super-block location is fixed so that vari- ous system utilities know where to locate it. Super-block fields contain the following fundamental sizes and offsets: The block size of the file system. VxFS supports block sizes of 1024, 2048, 4096, and 8192 bytes. The default block size depends on the size of the file system when you create it. See the bsize option in mkfs_vxfs(1M) for specific values. The creation date of the file system. The system call supplies the time. The default size, in blocks, for indirect data extents. Currently set to 64 by default. The number of data blocks in the file system. A data block is a block which may be allocated to a file in the file system. A placeholder in instances when the creation date for a file system is expanded for more precision. Currently zero. The size, in bytes, of the immediate data area in each inode. Currently 96. The block address of the last log area block. You can specify the log area size with the command. If not specified, the default size is 256 blocks for a file system less than 8 megabytes in size, 1024 blocks for a file system from 8 megabytes to 512 megabytes, and 16384 blocks for file systems greater than 512 megabytes in size. For smaller file systems, the default is reduced to avoid wasting space. The block address of the first log area block. Currently two. The magic number for the file system. This number identifies the file system as a VxFS file system type. The number of file system allocation units. The number of direct extents supported by the mapping type (see the section describing inode list). Currently 10. The number of blocks, of size fs_bsize, in the file system. is an unsigned 32-bit number, so the maximum number of blocks in a VxFS file system is limited to 32 bits. The version number of the file system disk layout. The preceding fields define the size and makeup of the file system. To reduce the calculations required in utilities, some of the values are derived from the fundamental values and placed in the super-block. The super-block contains the following derived offsets: The number of data blocks in an allocation unit. The address, in blocks, of the first allocation unit. There can be a gap between the end of the intent log and the first allocation unit. This gap is used to align the first allocation unit on a desired boundary. The length of a free extent map in blocks. The length of an allocation unit in blocks. The length, in blocks, of the allocation unit alignment padding. A mask value such that (byte_offset fs_bmask) rounds the offset to the nearest smaller block boundary. A mask value such that (byte_offset fs_boffmask) yields the offset from the start of the nearest smaller block boundary. The log base 2 of fs_bsize. Used to convert a byte offset into a block offset. The offset, in blocks, of the first data block from the start of an allocation unit. An allocation unit header may contain padding to align the first data block to a specific boundary. A checksum of the above fields. A macro, verifies or calculates the checksum. The offset, in blocks, of the free extent map (emap) from the start of an allocation unit. The offset, in blocks, of the first data block from the start of the file system. The offset, in blocks, of the first free extent map (emap) from the start of the file system. The offset, in blocks, of the first free inode map (imap) from the start of the file system. The size, in blocks, of an indirect address block. An indirect address block is 8K bytes. This field is set to (8K / fs_bsize). The offset, in blocks, of the free inode map (imap) from the start of an allocation unit. The number of inodes in an allocation unit. The number of inode entries per block in the inode list. The VxFS inode is currently 256 bytes long. The log base 2 of fs_inopb. Used to convert an inode number into a block offset in the inode list. The log base 2 of fs_aublocks. The number of entries in an indirect address extent. An indirect address extent is currently 8192 bytes in length, making the value for 2048. The preceding fields are initialized when the file system is created and do not change unless the file system is resized. These fields are replicated in each allocation unit header. The following are additional fields which are dynamic: Set to when a file system is mounted for read/write access. Set to on a or successful The file system cannot be mounted for read/write access unless the field is An array of the current number of free extents of each extent size in the file system. Initial log ID for when the file system is mounted. The following flags are recognized: Set when a file system requires a full structural check to recover from an error. If this flag is set, a full check is performed after the replay recovery completes. Set when the file system was mounted with the option. If this flag is set, then no log replay recovery is performed. Set when an I/O error invalidated the log. If this flag is set, no log replay recovery is performed. Set when the log ID runs over ( 2^30 ). The log ID is reset at the next appropriate time (such as a mount or system sync). Set when a file system resizing is in progress. If an detects this flag, it performs a resize recovery. See fsadm_vxfs(1M) for a description of file sys- tem expansion. Set when a file system upgrade is in progress. If an detects this flag, it performs an upgrade recovery. File system name (6 characters). File system pack label (6 characters). The number of free data blocks. The version number of the log format. Set by the kernel on each mount to ensure that an running log replay understands the log format written by the kernel. The log format may change with each release, so all file systems should be clean before upgrading to a new release. Set whenever a mounted file system is modified. It indicates whether the super-block requires rewriting when a sync operation is performed. Reserved for future use. Last time the super-block was written to disk, indicated as the number of seconds and microseconds that have elapsed since 0:00:00 GMT January 1, 1970. The following fields are required by VxFS Version 2 disk layouts and later. These fields are set when the file system is created and do not change. They are replicated in each allocation unit header. A checksum of fields. The size, in bytes, of a disk inode. Currently 256 bytes. The number of indirect address levels per inode. The length, in blocks, of a free inode map in an inode allocation unit. The size, in blocks, of an inode allocation unit. The size, in blocks, of the object location table extents pointed to by An array of two extent addresses. These extent addresses point to the two replicated copies of the first object location table extent. SEE ALSO
fsadm(1M), fsadm_vxfs(1M), fsck(1M), fsdb(1M), mkfs(1M), mount(2), time(2), inode_vxfs(4). fs_vxfs(4)
All times are GMT -4. The time now is 04:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy