I have a partition sdb1
of size 3.3 GB. From 3.3 GB only 1.9 GB is used and 1.2 GB is an empty space. I want to create an image of this partition.
But I want the image to only have the used space i.e. 1.9 GB
Now when I run a command using dd:
dd if=/dev/sdb1 of=/home/data/Os.img bs=1M status=progress
I saw behavior that dd is making the image of 3.3 GB While I don't want the unallocated space to be the part of the OS image.
So I tried different solutions. I found one solution:
dd if=/dev/sdb1 of=/home/data/OS.img bs=1M count=1946 status=progress
This solution created an image of 1.9 GB as I have defined a block size of 1M and count is 1946 which will give 1.9 GB totally.
Question I am unable to determine if this dd command only made an image of the used space or it just created an image of size 1.9 GB in which there are both used and unused spaces?
And is there any other way in which the image can be created for the used space only?