Sponsored Content
Top Forums Programming locate holes in a sparse file. Post 302317006 by alien999999999 on Sunday 17th of May 2009 05:12:05 PM
Old 05-17-2009
hmm, so there is no specialized way? syscalls, ext3 libraries to get that information?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sparse files

what are sparse files? (2 Replies)
Discussion started by: areef4u
2 Replies

2. Shell Programming and Scripting

How to copy file and locate in new folder?

Hi All, Please advise me how to make a copy of file from a list and store in one particular location? For example , I have aaa.txt which contains as below, But, those *usg files might be randomly store in different location.... > cat aaa.txt adc.usg dfdjkf.usg ugjfk.usg And I want... (3 Replies)
Discussion started by: cedrichiu
3 Replies

3. UNIX for Dummies Questions & Answers

URGENT! How to copy with holes?

I need to write a program that reads in data from a file with holes and copy the file. the cp command copies the file but the holes use disk blocks then; but when this progrm copies the file the new file should not have hose extra blocks. the file should be copied with holes. PLZZ help! (2 Replies)
Discussion started by: kominbhai
2 Replies

4. Shell Programming and Scripting

Locate file and path

Hi, I am writing a script to manage my server a bit better, but want to make it so if a path changes I dont need to update the script. I was thinking of doing something like if then echo -e "psa/admin/sbin located " else echo "no luck chump" fi but would need to... (2 Replies)
Discussion started by: foz
2 Replies

5. UNIX for Advanced & Expert Users

Locate text in file then remove and replace

I'm trying to locate a block of text in a file, remove it and then replace with a new block. I can find the first line number that the text starts on using grep -n. I then need to locate the ending line by searching for the string "}" that follows the line I found. Here's the steps I need to... (1 Reply)
Discussion started by: lchandle
1 Replies

6. Shell Programming and Scripting

File creating in another path.. application unable to locate

I am submitting a concurrent program (of HOST tyme) from Oracle apps screen, The MAIN shell program submits another program, (child) which is also a Shell program. The child writes data to log file. Now the main program, read the log and do some calculations and sends the data to user through... (1 Reply)
Discussion started by: Pradeep Garine
1 Replies

7. Shell Programming and Scripting

Convert a matrix to sparse representation

Hi All, I have a matrix stored in a file matrix.mtx and looks like this: 1 0.5 0.33 0.25 0 0.33 0.25 0.2 0 0 0 0.16 0 0 0 0.14 I want to convert this matrix to its sparse representation like the one give below (sparse_matrix.mtx). This means that above matrix has been converted to its... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

8. Shell Programming and Scripting

using find but avoiding sparse files

I am no Unix administrator...I live in windows land. I wrote a script to find files of certain names and process them but was later advised to avoid checking sparse files since it would use up a lot of resources and the files I was looking for were not there. How do I avoid doing the find on... (3 Replies)
Discussion started by: shellFun
3 Replies

9. Programming

C Data Structure to represent a Sparse Array

Which data structure will be most appropriate to represent a sparse array? (1 Reply)
Discussion started by: rupeshkp728
1 Replies

10. UNIX for Dummies Questions & Answers

Locate the column names with their values in the file and the printing the same in the other file

I have text file in Linux with two rows : first row conmtain the column nam and the second row contain its value .I nned to fetch few columns first and then redirect the data of those colum in the another file. Any ideas?? (1 Reply)
Discussion started by: Anamica
1 Replies
FALLOCATE(1)							   User Commands						      FALLOCATE(1)

NAME
fallocate - preallocate or deallocate space to a file SYNOPSIS
fallocate [-c|-p|-z] [-o offset] -l length [-n] filename fallocate -d [-o offset] [-l length] filename fallocate -x [-o offset] -l length filename DESCRIPTION
fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks and marking them as uninitialized, requiring no IO to the data blocks. This is much faster than creating a file by filling it with zeroes. The exit code returned by fallocate is 0 on success and 1 on failure. OPTIONS
The length and offset arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. The options --collapse-range, --dig-holes, --punch-hole and --zero-range are mutually exclusive. -c, --collapse-range Removes a byte range from a file, without leaving a hole. The byte range to be collapsed starts at offset and continues for length bytes. At the completion of the operation, the contents of the file starting at the location offset+length will be appended at the location offset, and the file will be length bytes smaller. The option --keep-size may not be specified for the collapse-range operation. Available since Linux 3.15 for ext4 (only for extent-based files) and XFS. -d, --dig-holes Detect and dig holes. This makes the file sparse in-place, without using extra disk space. The minimum size of the hole depends on filesystem I/O block size (usually 4096 bytes). Also, when using this option, --keep-size is implied. If no range is specified by --offset and --length, then the entire file is analyzed for holes. You can think of this option as doing a "cp --sparse" and then renaming the destination file to the original, without the need for extra disk space. See --punch-hole for a list of supported filesystems. -i, --insert-range Insert a hole of length bytes from offset, shifting existing data. -l, --length length Specifies the length of the range, in bytes. -n, --keep-size Do not modify the apparent length of the file. This may effectively allocate blocks past EOF, which can be removed with a truncate. -o, --offset offset Specifies the beginning offset of the range, in bytes. -p, --punch-hole Deallocates space (i.e., creates a hole) in the byte range starting at offset and continuing for length bytes. Within the specified range, partial filesystem blocks are zeroed, and whole filesystem blocks are removed from the file. After a successful call, subse- quent reads from this range will return zeroes. This option may not be specified at the same time as the --zero-range option. Also, when using this option, --keep-size is implied. Supported for XFS (since Linux 2.6.38), ext4 (since Linux 3.0), Btrfs (since Linux 3.7) and tmpfs (since Linux 3.5). -v, --verbose Enable verbose mode. -x, --posix Enable POSIX operation mode. In that mode allocation operation always completes, but it may take longer time when fast allocation is not supported by the underlying filesystem. -z, --zero-range Zeroes space in the byte range starting at offset and continuing for length bytes. Within the specified range, blocks are preallo- cated for the regions that span the holes in the file. After a successful call, subsequent reads from this range will return zeroes. Zeroing is done within the filesystem preferably by converting the range into unwritten extents. This approach means that the spec- ified range will not be physically zeroed out on the device (except for partial blocks at the either end of the range), and I/O is (otherwise) required only to update metadata. Option --keep-size can be specified to prevent file length modification. Available since Linux 3.14 for ext4 (only for extent-based files) and XFS. -V, --version Display version information and exit. -h, --help Display help text and exit. AUTHORS
Eric Sandeen <sandeen@redhat.com> Karel Zak <kzak@redhat.com> SEE ALSO
truncate(1), fallocate(2), posix_fallocate(3) AVAILABILITY
The fallocate command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux April 2014 FALLOCATE(1)
All times are GMT -4. The time now is 11:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy