6

How do I mount /mnt/sdcard/data as /data. Right now the /data has its own partition but it's too small (~500mb) and I would much rather give it more space than move apps and other things to my SD card.

My device is Micromax Canvas 2 A110.

It has a ~2GB internal sd card mounted at /mnt/sdcard2
and an external one at /mnt/sdcard and /sdcard
(I'm on some custom rom that switches internal and external default mount points like that)

I don't know what filesystem those are in.

2
  • What's the filesystem on your external sd? Also, tell more about your device..
    – iOS
    Commented Jan 24, 2013 at 6:26
  • @SachinShekhar added details in the edit. Commented Jan 24, 2013 at 6:34

2 Answers 2

4

This is the way to have /data on the SD Card directory:

  1. Copy all /data to the SD card directory: /mnt/sdcard/data
  2. Delete /data
  3. Create a symlink that points to the SD: ln -s /mnt/sdcard/data /data

The main problem is that /data could be EXT2/3/4 partition, while the SD Card is FAT32. The best thing to achieve what you want is to create an extra partition on the SD Card as EXT2/3/4 filesystem. Then you can link the directory /data with the partition.

When the phone restarts, it will mount the data partition more or less like this:

mount <args> /dev/block/mmcblk0p2 /data

Since /data is pointing now to /mnt/sdcard/data, the above command is equivalent to this one:

mount <args> /dev/block/mmcblk0p2 /mnt/sdcard/data

So in the end, we would have our data partition mounted in the SD card. Again, it should be in a separate partition, so we have the SD card as FAT and the extra partition as EXT2/3/4 so it won't fail when it mounts due to the filesystem.

If you want a more elegant solution, you can try any of the XDA Developers App2SD scripts, they let you achieve the same but without symlinking (it will mount it and bind it to /data). You will only need a Custom Recovery to be able to flash them. You can check them here.

3
  • What does a reboot mean in your example? The init-scripts probably want to mount the original /data partition then. Won't that be a problem?
    – Izzy
    Commented Jan 24, 2013 at 12:06
  • When rebooting the phone, it will mount the data partition in /data. Since it now points to the SD card, it will mount it there and it shouldn't be a problem since we're using the same filesystem.
    – Peter
    Commented Jan 25, 2013 at 8:13
  • @Peter On Android 5.0+, any symlink at root level like /data here removed during reboot ? No ? So what is the actual solution? Commented Aug 6, 2023 at 21:27
-1

i had the same problem and my external sd card was in extsd, /mnt/extsd, and the one inside the tablet was in /mnt/sdcard.

I spend 3 hours to figure this out.

Hope this helps someone. Thanks

1
  • 1
    Sorry, but this doesn't really answer the question. The asker wasn't asking where his SD card data resides, he was asking how he could use a portion of the SD card to provide more space for apps and data. See the answer above. Commented May 4, 2013 at 4:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .