[General Questions and Answers] ANDROID QUERY:
URGENT GZIP dump image of userdata problem ADB SHELL DD IF GZIP IMAGE FILE SIZES

I m using android lolipop 5.1.1 i in Qualcom smart phone was trying to root the phone i created Image file with dd command then rooted got some problems then again recovered it but when I created a fresh image file of unrooted recovered factory reset its showing different sizes for detail i am showing the commands and outputs

Created mmcblk0.img.gz through dd of /dev/block/mmcblk0 gzip

~ # ←[6n dd bs=4k conv=sync,noerror if=/dev/block/mmcblk0 | gzip -c -9 > /external_sd/mmcblk0.img.gz

(15634268160 bytes (14.6GB) copied, 8996.230485 2 hrs 50 min seconds, 1.7MB/s)

File mmcblk0.img.gz created in external sd card formatted in ext4 showed by ls -l shows 3.68 GB size of mmcblk0.img.gz file

~ # ←[6n ls -l /external_sd/.

-rw-rw-rw- 1 root root 3957044725 (3.685GB) Jan 5 12:32 /external_sd/mmcblk0.img.gz

where as when checked the /external_sd/ card mmcblk0.img.gz file size occupied space by df -h it showed 7.7GB occupied space

~ # ←[6n df -h

Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk1p1 14.0G 7.7G 5.5G 58% /external_sd

~ # ←[6n df -hi

Filesystem Inodes Used Available Use% Mounted on
/dev/block/mmcblk1p1 3.7M 12 3.7M 0% /external_sd

when i pulled mmcblk0.img.gz file to pc computer then it shows of 7.68 GB

~ # ←[6n adb pull -p /external_sd/mmcblk0.img.gz

Copied in System 7.68 GB (8,252,012,021 bytes) file

Previously 5 days before rooting and flashing i took the same backup of mmcblk0.img.gz file with same command

adb pull -p /external_sd/mmcblk0.img.gz

1.48 GB (1,599,262,720 bytes)

i have taken individual images also off boot.img recovery system.img and userdata.img i founded that the new images of userdata is high as well system when is less for details of user data i am giving details below

Created userdata.img.gz through dd of /dev/block/mmcblk0p29

~ # ←[6n dd bs=4k conv=sync,noerror if=/dev/block/mmcblk0p29 | gzip -c -9 > /external_sd/userdata.img.gz

(12748570112 bytes (11.9GB) copied, 7325.311486 seconds, 2.0 hrs 1.7MB/s)

File userdata.img.gz size created in external sd card formatted in ext4 showed by ls -l shows 1.5Gb size of userdata.img.gz file

~ # ←[6n ls -l /external_sd/.

it was showing 1.5gb file

where as when checked the /external_sd/ card size of userdata.img.gz file occupied by df -h it showed 6.8 gb occupied space

/dev/block/mmcblk0p29 IS SHOWING SIZE MOUNTED IN /DATA /SDCARD OF 866.5 USED BUT ITS IMAGE IS 6.7 GB

~ # ←[6n df -h

Filesystem Size Used Available Use% Mounted on

/dev/block/mmcblk0p29 11.6G 866.5M 10.7G 7% /data

/dev/block/mmcblk0p29 11.6G 866.5M 10.7G 7% /sdcard

/dev/block/mmcblk1p1 14.0G 6.7G 7.3G 47% /external_sd

~ # ←[6n df -hi

Filesystem Inodes Used Available Use% Mounted on

/dev/block/mmcblk0p29 760.0K 1.9K 758.1K 0% /data

/dev/block/mmcblk0p29 760.0K 1.9K 758.1K 0% /sdcard

when i pulled userdata.img.gz file to pc computer then it shows of 6.7 GB

adb pull -p /external_sd/userdata.img.gz

(1390 KB/s 7020532851 bytes 6.538 GB in 4929.140s 82.15 min)

userdata.img.gz file created in computer is 6.53 GB (7,020,535,808 bytes)

Previously 5 days before rooting and flashing i pulled userdata.img.gz image with same command

adb pull -p /external_sd/userdata.img.gz

337 MB (353,608,243 bytes)

Summarized:-

DD if gzip -9 mmcblk0.img.gz compressed 15,634,268,160 bytes (14.6GB) Device data to external sd card ext4 file system

ls -l shows the file mmcblk0.img.gz size of 3,957,044,725 bytes (3.685GB) ext4 file system

Df-h shows the sd card having only one file with space occupied in external sd card with 7.77GB space

adb pull copied mmcblk0.img.gz file of 7.68 GB space (8,252,012,021 bytes)

the old image dumped file mmcblk0.img.gz of same phone and same mobile was 1.48 GB (1,599,262,720 bytes)

Founded userdata.img.gz has been enlarged

DD if gzip -9 userdata.img.gz compressed 12,748,570,112 bytes (11.9GB) Device data to external ext4 file system

ls -l shows the file userdata.img.gz size of 1.5 Gb ext4 file system

Df-h shows the sd card having only one file userdata.img.gz with space occupied in external sd card with 6.8gb space

/dev/block/mmcblk0p29 IS SHOWING SIZE MOUNTED IN /DATA /SDCARD OF 866.5M USED BUT ITS IMAGE IS 6.7 GB

adb pull copied file userdata.img.gz of 7020532851 bytes 6.538 GB

the old image dumped file userdata.img.gz of same phone and same mobile was 337 MB (353,608,243 bytes)

Now my queries kindly help and explain:-

Is there any problem with dd if gzip command syntax and options

why mmcblk0.img.gz file ls- l shows 3.685GB and df -h shows 7.7GB occupied in external_sd card and same in case of userdata.img.gz file ls -l shows 1.5gb but the occupied space as per external sd card is 6.8gb

why when the file mmcblk0.img.gz file pulled is 7.68 gb as its 7.7gb in df-h and i same in case of userdata.img.gz file pulled is 3. 6.538gb as its 6.7 Gb in df -h

why Df-h of /dev/block/mmcblk0p29 IS SHOWING SIZE MOUNTED IN /DATA /SDCARD OF 866.5M USED BUT ITS IMAGE IS made file name userdata.img.gz 6.7 GB and 1.5 Gb in ls-l

why 5 days before i flashed my rooted phone had pulled image file of mmcblk0.img.gz was 1.48 GB (1,599,262,720 bytes) and now it extended to 7.68 gb and in same way userdata.img file before was 337 MB and now its extended to 6.8gGB

Question is which file to keep and which one is ok or not mmcblk0.img.gz of 1.48 gb or 7.68 gb and same of userdata.img.gz file of 337mb or 6.85gb

before recovering i did erased userdata and system by command

flashboot erase userdata

I had uncompressed userdata previously by following command as gz file cant be flashed

gzip -d -c /external_sd/userdata.img.gz | dd of=/dev/block/platform/7824900.sdhci/by-name/userdata

is there any problem with command of recovering

As df -h showing /dev/block/mmcblk0p29 866.5M of data in df -h

in my guess thoughts after rooting there is some space occupied in userdata

flashboot erase userdata

didnt erased the userdata and there is some background data left which has been not been erased and still occupying space in creating dump image file

safe way to delete erase unused space in userdata or block/mmcblk0p29

[*]the major concern is that i want to keep backup of my rooted and fully loaded phone and unrooted also so i want to decrease the size of image which after compressing is large

After googling i coundt find an safe command to compress the image now question is that should i fill the mmcblk0p29 block or userdata zero data with zero by following command kindly tell me the safest and best command from to get the appropriate command for the problem

fastboot erase userdata

rm -r /data/. or rm -r /sdcard/. c. dd if=/dev/zero of=/dev/block/platform/7824900.sdhci/by- name/userdata bs=8192

or

dd if=/dev/urandom of=/dev/block/platform/7824900.sdhci/by- name/userdata bs=8192

(but i could not find any /dev/zero or /dev/urandom in my dev direcotry)

newfs command to format the userdata partition but i dont know its options any other best safe command to solve the problem

thank you in advance waiting for quick and urgent suggestions replies and advice