Is this the right way to use dd for a full backup?


Question

Sadly my device (sm-g3185) isn't supported by either CWM or NANDbackup, so I am trying to do a backup manually. I found this thread which tells me to open a terminal (I'm on Arch Linux) and run:


adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

And then open another terminal and run:


adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

I did all this and it seems to be working. However, there was a delay of a few seconds between launching the dd command in terminal1 and the nc command in terminal2.


Can I trust the backup I created in this way? Doesn't this mean that I've lost some of the output of dd? Shouldn't these be run concurrently or, at least, shouldn't the nc command be started before the dd one?


Answer


Can I trust the backup I created in this way?



Yes, of course! This is the most accurate backup method.


Data integrity can be verified by comparing the outputs of running md5sum(1) on both the /dev/block/mmcblk0 volume on your device and the mmcblk0.raw disk image on your computer.


Additionally, you can use parted(8) to list all the partitions on the backup file:


parted /path/backup/mmcblk0.raw print

There you will find your system and userdata partitions, among many others containing bootloaders, firmware and recovery images.



There was a delay of a few seconds between launching the dd command on the device and the nc on the host computer. Doesn't this mean that I've lost some of the output of dd?
Shouldn't these be run concurrently or, at least, shouldn't the nc command be started before the dd one?



Don't worry! When you run nc -l, it will listen for an inbound connection, blocking the pipe and keeping dd from sending data until you establish the connection from your computer.




Note: you don't need to run adb forward tcp:5555 tcp:5555 twice.


Warning


Most of the modern devices encrypt all your data. Make sure that you can decrypt the backup file and access your data before erasing the phone.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes