mount(8) brings filesystem specific code into the environment. Tell me how you are going to do this WITHOUT invoking the mount command!
Try gzip'ing /dev/sdd1 and look at the size of the resulting file! (i.e., /dev/sdd1 being the raw/block device without ANY knowledge of the filesystem it is currently supporting!)
Then, you can't arbitrarily shrink a "filesystem" because you don't know where the "live data" resides on it, currently. A file could sit in the last N sectors of the partition and you wouldn't know it. Shrinking the partition by M>N sectors means your file gets cut off the end!
(you have to explicitly or implicitly MOVE the file to ensure it doesn't fall past the end of the trimmed partition)
I'm going to give you a RAW disk. It has data on it and "deleted data". I don't want to waste space preserving the "deleted data" in the image that I create.
When you install that disk in your machine, you are going to discover that you can't "mount" it! I have changed the partition ID to some wacky value that the system from which I pulled it recognizes as "Customized FFSv2 Partition". The only thing that is really "customized" about it is this oddball partition type identifier *and* a macro wrapper that causes each reference to an inode to refer, instead, to "~inode".
The system on which the drive was mounted (containing these two changes) has no problem creating, accessing and deleting data on that medium. With virtually identical performance to a "genuine" FFSv2 filesystem.
But, YOUR tools won't recognize its contents. (I suspect simply changing the magic number assigned as the partition type would be enough to cause problems!)
[Of course, this is a hypothetical machine. I pose this to illustrate the case for ANY FILESYSTEM TYPE NOT CURRENTLY KNOWN TO YOUR IMAGING TOOLS!]By contrast, the scheme that I outlined (upthread) will allow me to "fill" unused areas of the drive with "predictable, highly compressible content" USING THE NORMAL USER TOOLS PRESENT ON THAT ORIGINAL SYSTEM. Then, unlink those files. And, finally, run my executable OUTSIDE the scope of that OS (as it only needs to deal with the raw disk hardware).
You, OTOH, can best hope to do something like: dd if=/dev/raw_drive | gzip > image.gz And, your image.gz will typically be much larger because it will not be able to determine which is "deleted data" in the raw disk contents.