• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Identifying sparse files using getattrlist()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identifying sparse files using getattrlist()


  • Subject: Re: Identifying sparse files using getattrlist()
  • From: Peter O'Gorman <email@hidden>
  • Date: Tue, 03 Nov 2009 09:55:08 -0600

On 11/03/2009 09:35 AM, rohan a wrote:
Hello All,

Please help me. Need it urgently.

I think you should just be using stat(2) and comparing st_size with st_blocks*512.


But UFS seems to have gone away, so I was unable to create a UFS disk image to check.

Peter


Thanks

On Tue, Nov 3, 2009 at 4:34 PM, rohan a<email@hidden> wrote:
When I use
# mkfile -nv 4g sparse
on a 7GB Apple_UFS partition

df -k gives me this :

#df -k
Filesystem   1024-blocks Used Available Capacity  Mounted on
/dev/disk2s3     7390568   40   7021000     1%    /Volumes/UFSVolume

This indicates that the file created is sparse since it shows Capacity as 1%

On Tue, Nov 3, 2009 at 4:27 PM, Alastair Houghton
<email@hidden>  wrote:
On 2 Nov 2009, at 13:37, rohan a wrote:

I am trying to identify if a particular file is a sparse file using
getattrlist()

I am using this :     attrList.fileattr    = ATTR_FILE_TOTALSIZE |
ATTR_FILE_ALLOCSIZE;

According to the man page if  ATTR_FILE_ALLOCSIZE<
ATTR_FILE_TOTALSIZE the file is a sparse file.

I created the sparse file using dd
#dd if=/dev/zero of=sparse-file bs=1 count=0 seek=3g

However, both AllocSize and TotalSize are returning the same size
while actually AllocSize<  TotalSize

I am using UFS

Does Apple UFS even support sparse files? Remember, UFS is a name used by a fair number of totally different and usually incompatible filesystems. I haven't really ever bothered investigating exactly what Apple's UFS can and can't do... indeed, I've always had the impression that it was only really present for the benefit of old-time NeXT users who might have compatible filesystems floating around already.


--
Peter O'Gorman
http://pogma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Identifying sparse files using getattrlist()
      • From: rohan a <email@hidden>
References: 
 >Identifying sparse files using getattrlist() (From: rohan a <email@hidden>)
 >Re: Identifying sparse files using getattrlist() (From: Alastair Houghton <email@hidden>)
 >Re: Identifying sparse files using getattrlist() (From: rohan a <email@hidden>)
 >Re: Identifying sparse files using getattrlist() (From: rohan a <email@hidden>)

  • Prev by Date: Re: Identifying sparse files using getattrlist()
  • Next by Date: Re: Identifying sparse files using getattrlist()
  • Previous by thread: Re: Identifying sparse files using getattrlist()
  • Next by thread: Re: Identifying sparse files using getattrlist()
  • Index(es):
    • Date
    • Thread