LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-17-2005, 03:12 AM   #1
madhukirant
LQ Newbie
 
Registered: Aug 2005
Posts: 2

Rep: Reputation: 0
reserving space on the disk for sparse files


HI All,
Currently i am using SLES9 and i am creating sparse files using "dd" system call. However i need to reserve space for these sparse files on the disk. Earlier i used "XFS_IOC_RESVSP64" ioctl flag to reserve space for a sparse file on XFS. I would apprecitate if anyone can give me a similar way to reserve space for a sparse file on either ext3/reiserfs.


PS: i have tried populating the file with characters for every 512/4096 bytes but it takes lot of time as the file size grows.... approximately 10 minutes for a 15GB file. i need to reserve space in minimum time possible.

thanks
Madhu
 
Old 08-17-2005, 08:29 PM   #2
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
what's that dd system call? :s
sparse files (files with holes) are supposed to save disk space by not using it for a contiguous buffer of zero bytes.

One strategy you may use is to lseek() X-1 bytes and then write a '\0' for a file that will have X bytes.
ftruncate() may be used too to extend a file but these semantics are not the same on every OS
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Low disk space, problem deleting files gtzpower Linux - Software 1 05-24-2005 10:57 PM
rm'ing files doesn't free up disk space Earlw Fedora 4 03-06-2005 07:40 PM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 04:58 PM
what files can be safely deleted to save disk space? rohan208 Linux - General 9 05-27-2004 09:06 PM
Disk space wastage 73 GB Hard disk rajgopalhg Linux - Hardware 2 10-18-2002 04:41 PM


All times are GMT -5. The time now is 07:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration