Uthman
Uthman

Reputation: 9807

Developing a sector based partition copying program?

I want to develop a program that copies a partition's 'data' only, to another partition. And I want to do it such that the program starts from the first sector of source partition and checks if a sector is used.

If it is used copy it to the destination parition. Else don't copy.

In other words it's like copying only the contents of a partition to another, sector-by-sector.

Question: Is there a way to check if a particular sector on harddisk is used or not?

The programming language I am using is C++ and the underlying filesystem in NTFS.

Thanks a lot.

Upvotes: 0

Views: 398

Answers (3)

Tarnay Kálmán
Tarnay Kálmán

Reputation: 7066

ntfsclone is pretty much what you just described.

It can skip unallocated blocks when copying.

Upvotes: 0

MSalters
MSalters

Reputation: 179877

Your question is fundamentally flawed. NTS can store data and metadata in the same cluster. Both are handled as file attributes.

I'm also wondering what the point is. Without the metadata, raw data is useless. You can't even tell where one file ends and another begins.

Upvotes: 1

Nick Dandoulakis
Nick Dandoulakis

Reputation: 43120

IIRC, sectors store only raw bytes and low level error-specific data. The info you need is a sort of meta-info which only the file system can provide to you.

Upvotes: 1

Related Questions