Is there any way to recover data from 2nd SD partition?


Question

From the beginning. I was using Link2SD in order to save up some internal memory, but today I noticed that all apps moved to to second partition (EXT2) magically disappeared. I don't want to repair Link2SD because I'm going to change phone very soon. I want to recover data from /data/sdext2, but i can't mount it. I want to recover this data because I change SDCard too. Link2SD saying something about invalid argument during creating mount script. Is there any way to access this data so far? Or I must say goodbye to them?



PS. First partition is safe and sound. It works great.


Answer

To access second partition on SD card if it's not deleted, you may adopt multiple approaches listed below. For deleted partitons or deleted files, you may use tools like testdisk and extundelete which doesn't seem to be the case here.



LINUX / WINDOWS



As mentioned by @iBug, you can remove SD card from phone and insert in a PC with Linux OS like Ubuntu. You will be able to access both partitions there. File browsers like Nautilus and Dolphin by default show all formatted partitions in left panel on newly inserted media.

In order to directly mount a partition from Android device to Linux PC, you can expose it as a USB Mass Storage device. By default UMS is disabled on newer devices but can be enabled by a little hacking.



Windows by default only mounts first accessible partition on SD cards and other removable media. However, if you want to access second partition on Windows, it is possible. You need to make SD card a local hard disk drive using a hacked driver like Cfadisk usb driver. Follow this link for detailed guide.



ACCESS 2nd PARTITION FROM ANDROID



Some custom builds of TWRP auto-mount SD card second partition under something like /sd-ext etc. If not so, you can mount it yourself in Android recovery or ROM, as you seem to have already rooted device.




  1. Reboot in TWRP recovery and use built-in terminal app there. Or if you want to do it from ROM, install terminal emulator app like Terminal Emulator if you don't have one already. Third option is to use adb, in ROM or in recovery.

  2. Find how kernel names block devices on your phone:



    ~# ls /dev/block/


    You will find a number of devices there. On a typical Qualcomm device, mmcblk0 will be representing internal memory i.e. eMMC and mmcblk1 will be representing external SD card. Though there will be many other internal partitions and loop devices, we are concerned with three entries of external SD card:



    mmcblk1
     mmcblk1p1
     mmcblk1p2


    Here mmcblk1p2 is the second partition on SD card.


  3. For confirmation:



    ~# fdisk /dev/block/mmcblk1p2


    This will show details about SD card second partition including size.


  4. Mount partition:



    ~# mkdir /sd_ext
    ~# mount -o ro /dev/block/mmcblk1p2 /sd_ext


    First command will create a directory sd_ext under your root which you may access from any file explorer or command-line. ro option in second command will mount the partition read-only so that you may not harm any data accidentally. You may eliminate this.

    If not successful, you may need to specify filesystem yourself what you used at the time of partitioning:



    ~# mount -t ext4 -o ro /dev/block/mmcblk1p2 /sd_ext


    To know which filesystem a partition has:



    ~# blkid /dev/block/mmcblk1p2


    There are many other tools that can be used for the purpose like parted, fsck and tune2fs etc. but these might not be necessarily available.


  5. Mounted partition will be un-mounted automatically on reboot. You can do this manually:



    ~# umount /sd_ext



NOTE:




  1. Be cautious not to touch second partition on internal memory which may belong to bootloader. Or you may brick your phone.

  2. All commands used above need root access and binaries are included in TWRP. You may install busybox in ROM if any command not found.



RELATED:




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