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.
- 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.
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.
For confirmation:
~# fdisk /dev/block/mmcblk1p2
This will show details about SD card second partition including size.
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.
Mounted partition will be un-mounted automatically on reboot. You can do this manually:
~# umount /sd_ext
NOTE:
- Be cautious not to touch second partition on internal memory which may belong to bootloader. Or you may brick your phone.
- 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: