Link2SD: mounting /dev/block/vold/179:66 on /data/sdext2 failed: No such file or directory


Question

I am using a rooted Xperia Z5 Compact E5823 with the latest stock Android 6.0 ROM.

I am trying to use a 2nd partition with Link2SD but so far I always get the same "No such file or directory"-error:



Mount script error


Mount script cannot be created.


mount: mounting /dev/block/vold/179:66 on /data/sdext2 failed: No such file or directory



To format my microSD card I've used GParted under Debian with ext2, 3, and 4, always as primary partition. I've also used TWRP recovery to format this 2nd partition. With this I have only tried ext3, which my Debian recognizes as ext2 and there seems to be no way to choose which type of partition (I suppose they have primary as default). With TWRP I could also try ext4 but preferred to 1st post here.


I do see a /data/sdext2 folder with help of a root file browser. This folder is empty.


The "file" /proc/partitions does show a 179 66 2000000 mmcblk1p2 entrance, which correspond to the second partition of my external SD card.


Link2SD has superuser permissions and its mount script /data/data/com.buak.Link2SD/init-link2sd.sh looks like this:



set +e

echo "$(date) mounting..." > $LOG

sleep 2

mount -t ext2 -o rw /dev/block/vold/179:66 /data/sdext2 1>>$LOG 2>>$LOG


mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG


mount >> $LOG

echo "$(date) mount finished" >> $LOG

chmod 773 /data/dalvik-cache



Answer

This error was very tricky to track! It took me a while to re-address it and here is what I have found out and how to solve it.



A little on mmcblk_p_




  1. SD cards are special about their "block-partition"-suffix, i.e. the -blk*p* part.

  2. For the user, the numbers in the suffix -blk*p* are, on practical matters, determined by the system the card is mounted on.

  3. Link2SD's script is sensitive to the correspondance of the microSD card's "internal" partition-suffix (-p*) and its "external"/"mounted" under some system. (Thus, the No such file or directory).



Solution



For Link2SD's default mount script to succeed, you must delete and re-do the microSD card's partition table (with GParted or similar) and then do its two (or more) partitions, the second one being an ext2-filesystem.
This will yield a correspondance on the suffix-numbers -p* of your "second ext2-partition" both in the card and under the system.



Background



Well, I noticed that each time an SDcad gets a new partition the last index in the suffix -blk*p_ "advances". The microSD card in question has been partitioned more that three times without resetting its partition table. That card has no "internal" -p2 eventhough Android's kernel addresses it as such! (Tricky, huh?!) It seams that Android's kernel only takes the number of existing partitions to create the /proc/partitions-addresses instead of the total count of partitions ever done under an existing partition-table.



Extra-Info



Link2SD guarantees that your second ext2-partition won't be shown on your PC when you plug your device to it via USB. This is true for Windows but unfortunately not true for GNU+Linux! Windows does not recognizes ext2-filesystems. GNU+Linux does. As a consequence some APPs might have trouble retrieving ingormation from /data/sdext2.



Finally



Link2SD latest version at the PlayStore is 4.3.4 from 21.06.2018 and it locates its mount-script at /data/data/com.buak.Link2SD/files.



Also, for more information, visit Link2SD's official site.


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