FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > EXT3 Users

 
 
LinkBack Thread Tools
 
Old 03-19-2009, 04:55 PM
Steven Chervets
 
Default Sparse File Creation

I need to create an 8 GB sized sparse file which will do an actual
block allocation. In other words, I want to allocate the blocks in
the directory structure, but not fill them with zeroes until they are
actually used. Since this will be implemented in a closed appliance
I'm not concerned about security and can execute any command as root.


I have tried the dd seek command. And while it creates a sparse file,
it doesn't reserve the blocks.


Thank you for your help.

Steve

_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 
Old 03-19-2009, 05:29 PM
Eric Sandeen
 
Default Sparse File Creation

Steven Chervets wrote:
> I need to create an 8 GB sized sparse file which will do an actual
> block allocation. In other words, I want to allocate the blocks in
> the directory structure, but not fill them with zeroes until they are
> actually used. Since this will be implemented in a closed appliance
> I'm not concerned about security and can execute any command as root.
>
> I have tried the dd seek command. And while it creates a sparse file,
> it doesn't reserve the blocks.
>
> Thank you for your help.
>
> Steve

Hi Steve -

On ext3 your only option to allocate a block is to write something into it.

On ext4, xfs, and similar extent-based filesystems, blocks are tracked
with more metadata (the extent structures) so they can be allocated
quickly and flagged as unwritten so that they will be read back as
zeros. You can get to this through the fallocate syscall, glibc's
posix_fallocate(3) (which falls back to 0-writing if the fs doesn't
support sys_fallocate), and in bleeding-edge glibc, the fallocate(2) call.

Since you say you don't care about security, ext3 could probably be
hacked to skip the actual block initialization part and expose garbage,
but this is generally something filesystem try *very* hard to avoid, and
I don't think there'll be any way to do it with the stock code.

-Eric

_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 

Thread Tools




All times are GMT. The time now is 03:22 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org