#It hasn’t even been a week, and you’re writing about this again.
Right. I learned a thing so I am writing about it, shut up and read on.
##Before you proceed…
- Read this first for a basic outline of concepts recycled here.
- Use of XDG stuff is prioritized over linking with
- Keep your physician on speed-dial.
- Genders are mentioned, prepare to be triggered.
This is mostly an addendum to the article linked above for Android use, because I didn’t want to bother with appending onto that. Also, if anyone encounters Android-specific issues, they can leave that here, rather than adding senseless noise in a more general-purpose article.
##Provisioning changes for use with an Android system
Android’s limited capabilities
If any USB-connected media is attached to an Android device, it is mandatory to have a partition formatted as ExFAT before any files can be deposited onto the attached media. There are however a few problems with this;
- Mandatory use of ExFAT ruins the idea of using an NTFS partition as overflow space
gpartedby default doesn’t even do ExFAT, no matter what you do (for legal reasons)
- Not only that,
gnome-disks’ device map is buggy and renders partitions incorrectly after editing.
- ExFAT doesn’t wear well on Mac OS X, and IT admins would have to provision use of it wherever you happen to use a guest Apple PC.
All of the above makes half of what I wrote earlier invalid, but we can still do something else based on a similar principal with
xdg-utils which will be explained later.
###Other stuff you’ll need
- An adapter to use SATA-connected media with USB
- If the host machine uses type-C and Intel’s Thunderbolt host controller, even better
- A cable to hitch other media via USB, which can be terminated from the adapter to-be-used in one of two ways;
- If non-replaceable, with a type-A female cable which terminates with the male variant of the connector on your phone
- If non-replaceable, with a type-A coupler / gender changer, then another type-A cable which terminates with the male variant of the connector for your phone
- If replaceable, a special-purpose cable which terminates at both ends compatible with your adapter and phone
- The end which goes into your phone can be one of three connections (usually);
- High-speed type-B
- Super-speed type-B (Samsung phones until type-C use this, usually)
Expand this to read more about USB.Why so many standards? It's simple to understand, really; USB started off as a host / client connector, using different types; type-A and type-B. Over time, miniaturization of the client connectors yielded mini-B, which is most often used on the cheapest of novelty equipment due to high supply and low demand, because no smartphone manufacturer in their right mind would use it over micro-B for host controller and connector thinness.
USB 1.0 and 1.1 had modest speeds at the time. As demand for improved data throughput increased, the consortium behind the USB standard established version 2.0, as well new requirements for cables. If you have a cable with a white substrate for the copper pins, that is an old-style 1.0 / 1.1 cable, while 2.0 had a black substrate. This was not always true, but you could validate claims of capability by that alone.
When USB 2.0 was released, and after the proliferation of Android handsets most manufacturers agreed upon USB 2.0 and the high-speed micro-B connector. But not Samsung; Dissatisfied with the performance of USB 2.0, they contracted manufacturers to make what is known as super-speed micro-B. This wider connector is often seen on their products, but other manufacturers purposed the connector for replaceable USB 3.0 cables in more professional-grade products where the cable is treated as something disposable. If this is the case, you can upgrade to USB type-C simply by replacing the cable, but do not expect USB 3.1 speeds.
Speaking of, USB type-C came out with USB 3.1, which to add even more confusion resellers referred each as 3.0 G1 and 3.0 G2, before it was made clear that type-C was expressly for USB 3.1. Type-C was made as a Universal standard that could be plugged in both ways. While USB type-A cables had similar features for some time, it was not common, and USB type-C is suppose to not just embrace both host / client roles, but also be depolarized as a standard feature so that plugging it into your phone and future computers isn’t a guessing game.
- USB type-C came out with USB 3.1 and works with everything in the USB spectrum
- Before type-C, type-A is for host devices, while type-B is for client devices
- Any USB plug can be paired with any host controller, but USB sockets only work best with their intended controllers.
Because I waxed on about partitions and related crap in the previous article I wrote, I won’t even bother; read that please and thank you.
##Executing provisioned changes
A lot of this is also very similar to the article I referenced above, so I’m glossing over the broader details in favour for explaining how to deal with Android.
Configure your partitions initially with
gparted so you have a partition for the system, maybe a partition for
/home and some swap space as you would a setup with NTFS as overflow. But rather than using NTFS, ExFAT is going to be used instead. There is a significant issue with that, however…
###How to deal with ExFAT
This can be set up before or after system installation, so long there is unallocated space for
gnome-disksto do its thing.
gparted can’t make it. There are no options anywhere else for it. So what is one to do? Fortunately there are packages to handle this, but after initial configuration (and inclusion of an extended partition if you please), you can ditch
gparted because it simply doesn’t work. So here’s how to make an Extended File Allocation Table partition;
sudo apt install exfat-*
- If that doesn’t work because you’re not using
bashfor shell, that’ll install
gnome-disksand select the media with unallocated space; select the unallocated space therein and click on the plus symbol
- Choose to use a custom partition format, specify
The device map goes a little screwy after that; Close
gnome-disks, unmount everything, disconnect the media and plug it back in (or if using the system already, restart) to resolve how the map displays the available partitions.
Once you confirm in
gnome-disks the ExFAT partition exists, you can then select it and have the kernel mount the drive on boot like you would an NTFS partition for the same purpose, but additional changes are necessary to purpose the partition as a general storage area for the stuff in your folder in
/home, all which can be done with
xdg-user-dirs-update. Modifying my previous script for linking directories into an NTFS partition, the below will instead assign the folders there to reside in the ExFAT partition.
For brevity, I will assume the partition is named
Androidand is mounted in
/mntbut you can call it whatever you please, just modify the script to suit.
# Replace "$USER" with specific usernames if necessary! ### Make new folders in the ExFAT partition mkdir -p /mnt/Android/Documents mkdir -p /mnt/Android/Downloads mkdir -p /mnt/Android/Pictures mkdir -p /mnt/Android/Music mkdir -p /mnt/Android/Videos ### Duplicate old contents (if any) cp -R ~/Documents /mnt/Android/Documents cp -R ~/Downloads /mnt/Android/Downloads cp -R ~/Pictures /mnt/Android/Pictures cp -R ~/Music /mnt/Android/Music cp -R ~/Videos /mnt/Android/Videos ### Delete folders rm -rf ~/Documents ~/Downloads ~/Music ~/Pictures ~/Videos ### Change XDG's reference for the now-deleted folders xdg-user-dirs-update --set DOCUMENTS /mnt/Android/Documents xdg-user-dirs-update --set DOWNLOAD /mnt/Android/Downloads xdg-user-dirs-update --set MUSIC /mnt/Android/Music xdg-user-dirs-update --set PICTURES /mnt/Android/Pictures xdg-user-dirs-update --set VIDEOS /mnt/Android/Videos
If you use Bluetooth,
blueman-services will complain about Downloads being relocated; fix that by telling it where the new Downloads folder is, and that should resolve the issue.
It’s not easy making something that works with Android, but it’s also not that hard it’s insurmountable. Whether it’s worth it depends on how much you value a hardline connection between your disk and your phone, but because bluetooth-enabled SATA adapters fell out of fashion for the inherit security concerns of anyone being able to find the device and access it, using the USB socket provided with your device is the only way to transfer from a disk to your phone content you wish to use. Being able to plug it into your computer running Windows, and booting a Linux system living alongside it is quite the bonus.