We have moved to a new Sailfish OS Forum. Please start new discussions there.
4

How to add SD CARD to Internal memory ?

asked 2017-12-12 10:38:32 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2017-12-12 10:38:32 +0300

sugashrajavelu gravatar image

16 gb is not enough so is there any way to make sdcard to act or add as internal memory (16+32 i.e 10.3 + 29.8). with or without partition anything is okay .

(Memory is the biggest problem iam facing as often i have to change app ,data,media files to sdcard often .that folders can't be copied to sdcard so have to copy individual files every time.)

edit retag flag offensive close delete

Comments

Why not always keep media files on sd card? They get indexed just fine there. Of course you can copy folders, but perhaps not using some gui app.

attah ( 2017-12-12 10:56:36 +0300 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2017-12-12 11:54:06 +0300

ziellos gravatar image

This howto is still valid.

This way the micro-sd storage is shared between Sailfish OS and Android. It is visible as SD card for Sailfish OS, and is treated as internal memory for Android apps.

edit flag offensive delete publish link more

Comments

And it's working fine, I have a 256GB Samsung in Xperia, Ext4-formatted with no issues. But the micro-sd should be fast (!) and big enough to fulfill future needs, because it should stay in the device. Frequent changes are not recommended, because it's a bit of work. Under Linux you can also easily connect your filemanager (for example Nautilus) to the phone (using sftp) and copy folders from there.

Also, if you use the "CargoDock"-filemanager from store, you can copy multiple files (or all in a folder) at once.

Robomike ( 2017-12-12 14:31:14 +0300 )edit

While this works the trouble is your backup and when your phone fails and you try to migrate to a new phone - that the crux of this solution because it may cause issues unkess someone can tell me tgey successfully migrated to a new phone from backup with such a setup?

DarkTuring ( 2017-12-12 19:16:13 +0300 )edit

To be honest, I never cared about a backup because Jolla backup is said to be incomplete, unreliable, and version dependent. I know that in case of a damage I have to install and configure every app manually again. Been there, done that.

My personal data however is 100% cloud-based (Exchange & Synology), no backup needed.

There is also no reason why copying /home/nemo (including android_storage) as a "backup" shouldn't work in the described configuration.

ziellos ( 2017-12-13 09:38:52 +0300 )edit

@DarkTuring : I can confirm that "something" works in case of need to restore backuped data on the card in this scenario. I found my E-mail accounts (but they were not working, because I installed the mail program after that), I found the contacts (luckily not doubling this time after syncing against my nextcloud) and I found the calendars (well, they were doubling, shit), and the pictures reappeared, too. The result with this solution is even better, because you'll have your android data there. Whatsapp found it's own backup spontanuosly after installation, for example.

But I agree with @ziellos, it's better to use a cloud based solution for the important stuff. If you have some linux command line skills, you can also extract and store a list of your repositories and installed apps for an easy re-installation. (I once had some serious troubles to save and restore the icon arrangement, so I guess it's not worth the pain.)

Robomike ( 2017-12-13 20:10:16 +0300 )edit
5

answered 2017-12-12 16:00:45 +0300

DrYak gravatar image

updated 2017-12-13 11:16:24 +0300

Alternative strategy : extend by adding the SD card to the volume management used by Sailfish.

WARNING : This requires the SD card to be inserted during the whole time when you use Sailfish. That's easier to do on smartphones that has a separate socked for SD cards (like Jolla 1) than smartphones using a single shared tray for changing both SIM card and SD card (like Xperia).

WARNING 2 : As pointed by @MartinK in the comments, spreading your data accross non-redundant devices increases risk of losing data - as soon a 1 devices goes down (either the eMMC inside the phone or the uSD card), you'll lose data.

  • In the case of BTRFS : the metadata is RAID1 across the devices, you'll lose "only" file contents and only the CoW versions stored on the lost device, filesystem structure should still be at least visible (And older snapshot and version of files might still be accessible from the still-alive device). There's no easy way to control which data ends up on which physical partition during rebalancing.
  • In the case of LVM : all the extent of the logical volume that are on the dead physical device are lost, it looks like suddenly having a huge amount of dead sector all-over the EXT4 filesystem and it will be more or less hosed. It's possible to fix extents to a specific physical volume by giving options to lvresize (eg.: lvresize -L +12G sailfish/root /dev/mmcblk1p1) or pvmove (eg.: pvmove -n home /dev/mmcblk1p1 /dev/mmcblk0p58)

TIPS

  • use µSDHC/µSDXC cards with a as high as possible quality (featuring ECC, dynamic wear-leveling, static-wear-leveling, etc.)
  • try to spread your partition wisely (keep in mind that when worse happens, you can still easily reset your root partition from factory)
  • always keep backups

BTRFS based smartphones

To my knowledge: only Jolla 1.

If you have an SD card with an unformated partition (or a partition that you can afford to lose) :

btrfs device add /dev/mmcblk1p1 / (change p1 accordingly if you use multiple partition on your sd card)

At that point, you can even activate RAID1 duplication for the metadata to add a bit of security, if you used single mode : btrfs balance start -v -f -mconvert=raid1 / (if you left the default dup, btrfs automatically converts between dup and raid1).

To reverse, as long as you have enough room on the internal memory to hold all your data, you can always : btrfs device delete /dev/mmcblk1p1 / (and wait until the linux kernel finishes balancing all the chunks to the internal flash`.

Do not forget to put back metedata into single mode if you use such a thing : btrfs balance start -v -f -mconvert=signle / (btrfs only automatically converts between raid1 and dup).

LVM+EXT4 based smartphones

As far as I know : Jolla C/Intex Aquafish, Jolla Tablet, Sony Xperia X, etc. Phones like Xperia X are bad candidates because the SD cards needs to be plugged in the whole time, but you need to take the tray out to change SIM cards. (So the only solution would be to completely power off the phone during SIM swaps)

Now you need to do in order :

  1. First format the partition to be usable in LVM : pvcreate /dev/mmcblk1p1
  2. Add the extra partition to the LVM volume group: vgextend sailfish /dev/mmcblk1p1
  3. Now you have extra space, you can extend one logical volume : lvextend -L+1G sailfish/home (or sailfish/root)
  4. ...and resize the file system itself : resize2fs /dev/sailfish/home (expansion works online, you don't need to umount first) (no need to specify size, by default all free space is used).

To reverse, you need to undo every single step.

  1. Shrinking isn't online with ext4. Meaning you need to either boot into recovery mode (or alternatively, for the home patition, you need to stop all users processes, and do umount /dev/sailfish/home as root).
  2. Shrink partition : resize2fs /dev/sailfish/home 12G
  3. Shrink logical volume : lvresize -L 12G sailfish/home (Pay attention to give the exact same size as previous step)
  4. Move all data of the physical volume pvmove /dev/mmcblk1p1
  5. remove the physical volume vgreduce sailfish /dev/mmcblk1p1
edit flag offensive delete publish link more

Comments

I'll just point out (and it's not ofence agains the really nice instructions!) that extending a volume group onto two physical devices significantly increases the likelylihood of failure.

The extents allocated to the LV will now reside on two physical devices. If either one of them fails, the LV is most likely hosed.

It's basically a tradeoff slightly similar in priciple to RAID0 - you get more space but there is a bigger chance of loosing data. Not a showstopper as long as you have (working!) backups, but definitely something to keep in mind. :)

MartinK ( 2017-12-13 02:10:50 +0300 )edit
0

answered 2017-12-13 18:52:36 +0300

figgis-diggis gravatar image

Why not just format the card into ext2 and edit /etc/fstab to mount it as /home/nemo? (if you are not satisfied with it being mounted somewhere in /media)?

edit flag offensive delete publish link more

Comments

can u please give a step by step instructions . i have not done that before. hee what exactly i need to change in fstab file ?

sugashrajavelu ( 2017-12-17 05:41:40 +0300 )edit
Login/Signup to Answer

Question tools

Follow
7 followers

Stats

Asked: 2017-12-12 10:38:32 +0300

Seen: 1,249 times

Last updated: Dec 13 '17