copying link2sd's sdext2 ( ext4 ) partition to another sd card - General Questions and Answers

like you might have guessed i am a windows user and i have bought a new bigger sd and i was trying to move the contents created on the sdext2 partition that was created using ext4 file system across to the newer card , now i understand that these files have to maintain permissions or things would get ugly , i am open for suggestions , i have a theory thought that i can use tar to compress the folder and maintaining permissions to the fat32 partition , copy it to windows then decompress it over the other card , but as expected i am getting all sorts of error messages on trying all syntax i could find online , what's the proper syntex to compress the entire partition into 1 single file and moving it to fat32 partition ?
on a side notice this was just me thinking out loud , if anybody has a better solution please feel free to share !
thanks in advance

Related

apps on sd card better way

Is there better way to get applications on sd card. Why are we using ext2 ? We can format sd card and partition it without using pc . We can format it into native supported file system of fat. why are need to make dev when in /dev/block device exist ? we need just to modifiee mounted.conf and /etc/fstab
I think because it's easier to say then to do But if you can make it so easy i love to use youre methode! (newest way is pretty easy, flash modded JF rom and exec a script and you are done: http://forum.xda-developers.com/showthread.php?t=480582)
I would think that you could run into issues with permissions/etc if you tried to use a FAT filesystem to store applications.
About the only advantge of FAT is its ubiquity. In every other regard there is a better solution out there. Ext2 is by far the most widely supported linux filesystem that supports the full POSIX feature set.
simply put FAT32/VFAT is a horid horid filesystem, and does not support unix permissions, symlinks, etc.
EXT2 is a native linux filesystem, supports all of the above and has been time tested as stable.
That said it would be slick to get EXT3 (or 4!) support, or even reiserFS support.... journaling FTW
Well, you could just compile the kernel module, but your flash would probably survive a week with journaling... theres a reason you don't use it on flash.
Flash gets worn down by use, and journaling writes every second... So, journaling FTL.
tritron777 said:
Is there better way to get applications on sd card. Why are we using ext2 ? We can format sd card and partition it without using pc . We can format it into native supported file system of fat. why are need to make dev when in /dev/block device exist ? we need just to modifiee mounted.conf and /etc/fstab
Click to expand...
Click to collapse
the phone is linux .. EXT2 is linux .. FAT does not support proper file permissions and if you wanted to try setting something up feel free .. however .. you mention "native" supported file system and that is linux .. storage on the SD comes standard with FAT file system simply because the phone only uses it to store extra files like MP3 and JPG etc .. applications need a higher level of communication that FAT just cannot handle .. that's why Microsoft gave up on it for windows

[Q] make links between ext4 and fat32

Because my ROM is big enough(around 8G), and my SDCard has been full with various files, so i want to link a big file stored in ROM to SDCard so as to save the treasure space of SDCard( the big file cannot be identified by a software except it is in /sdcard patition ) first i take an test to validate the method: try to link a file /data/test.mp3 to /sdcard/test_fat32.mp3, then in the terminal (#su), i tried to make a symbolic link like this :
Code:
ln -s /data/test.mp3 /sdcard/test_fat32.mp3
but failed:
ln: /sdcard/test_fat32.mp3: Operation not permitted
Googling for a while, and i found that i cannot create symbolic links with fat32, i dont want to format the SDCard to ext4, because i want to make such an app to share with my friends. you surely cannot demand everyone of the format, what's more, maybe many apps cannot identify ext4 files. does anyone have a good idea to realize it? or some other ways to access inner files and fake the app that it is a file in /sdcard? any help appreciated!

How to write file / folder to internal memory on rooted Android device

Hello,
I tried with root explorer, all seems ok, but after reboot created files and folders in internal memory disappear.
Where on the Internal Memory are you placing them? If their in / they will disappear when the phone reboots because the root filesystem is actually a ramdisk with /system, /data and /cache mounted on them and symlinked to fit. (I believe.)
i see so ... i want to write some files in /data/data/com_adobe_flashplayer/lib/ as wrote here http://forum.xda-developers.com/showthread.php?t=1359506 but after reboot they are gone
UN.TIGRU.NET said:
i see so ... i want to write some files in /data/data/com_adobe_flashplayer/lib/ as wrote here http://forum.xda-developers.com/showthread.php?t=1359506 but after reboot they are gone
Click to expand...
Click to collapse
That's because the package for "com_adobe_flashplayer" doesn't exist. It seems that the path might have gotten changed by the board for looking to much like a URL. Replace the underscores with periods and you should be good to go. Sorry it took so long to get back to you.
Hope I solved your problem
Alternatively, the post you linked contains a update you can flash through recovery that should fix your problem easily.

[Q] Link2sd relink file not working

Hello,
I have installed a lot of applications on my device and linked them to my sdcard with link2sd.
Those applications have been installed on a specific account (guest account) on my device.
I have changed my sdcard, create a new partition ext2 on it, copy and paste all the files, directories,... of the old partition to the new one, and tried to relink the new card with link2sd.
But -> "no file to link" !! :crying:
And I don't have anymore my old sdcard.
Means, today, I have no more application listed on my screen, no more application listed in the settings, no more application listed in "My applications" of the Google Play Store, but the memory of my device is completly full of specific files of the applications which were previoulsy linked to the previous sdcard.
In other word, it is the mess and I really need to recover my applications with the datas.
Does someone know how to fix this??? (even manually)
Thank you
clecocq1 said:
Hello,
I have installed a lot of applications on my device and linked them to my sdcard with link2sd.
Those applications have been installed on a specific account (guest account) on my device.
I have changed my sdcard, create a new partition ext2 on it, copy and paste all the files, directories,... of the old partition to the new one, and tried to relink the new card with link2sd.
But -> "no file to link" !! :crying:
And I don't have anymore my old sdcard.
Means, today, I have no more application listed on my screen, no more application listed in the settings, no more application listed in "My applications" of the Google Play Store, but the memory of my device is completly full of specific files of the applications which were previoulsy linked to the previous sdcard.
In other word, it is the mess and I really need to recover my applications with the datas.
Does someone know how to fix this??? (even manually)
Thank you
Click to expand...
Click to collapse
Did you try and re-create the mount scripts?
Are the paths exactly the same?
Try installing an app and then linking it with Link2SD. Then check the path of the linked data. Make sure it matches with your backups.
I'd personally go for clean installs when changing SD card, but I think you're brave for trying. Good luck.
tillward said:
Did you try and re-create the mount scripts?
Are the paths exactly the same?
Try installing an app and then linking it with Link2SD. Then check the path of the linked data. Make sure it matches with your backups.
I'd personally go for clean installs when changing SD card, but I think you're brave for trying. Good luck.
Click to expand...
Click to collapse
Yes tried the re-create mount script without success.
One information: The old partition was ext3 and this time I created an ext2. Is it important?
Where can I check the path of the linked data exactly?? Which file?
Thank you for your help.
clecocq1 said:
Yes tried the re-create mount script without success.
One information: The old partition was ext3 and this time I created an ext2. Is it important?
Where can I check the path of the linked data exactly?? Which file?
Thank you for your help.
Click to expand...
Click to collapse
Just so I have this right...
You backed up all the data and file structure from your ext3 partition, re-formatted it to ext2, then copied all the data and file structure back on.
Have a look in root explorer. What are the folder names of your two SDcard partitions under /root ?
Mine looks like this:
/root/sd-ext
/root/sdcard
/root/storage/sdcard0
I used a script from here: http://forum.xda-developers.com/showthread.php?t=1971689 so mine will probably be different to yours.
If your linked app files are in the same place as before, (check this by installing and linking a new app and then finding it's linked data in root explorer) and you get an error/ no result when re-creating mount scripts in Link2SD, then i'm at a loss.
There are a lot more knowledgeable people than me on these forums, so hopefully one of those people will see your post and offer you a solution. Otherwise, it's time to re-install all your apps I suppose.
tillward said:
Just so I have this right...
You backed up all the data and file structure from your ext3 partition, re-formatted it to ext2, then copied all the data and file structure back on.
Have a look in root explorer. What are the folder names of your two SDcard partitions under /root ?
Mine looks like this:
/root/sd-ext
/root/sdcard
/root/storage/sdcard0
I used a script from here: http://forum.xda-developers.com/showthread.php?t=1971689 so mine will probably be different to yours.
If your linked app files are in the same place as before, (check this by installing and linking a new app and then finding it's linked data in root explorer) and you get an error/ no result when re-creating mount scripts in Link2SD, then i'm at a loss.
There are a lot more knowledgeable people than me on these forums, so hopefully one of those people will see your post and offer you a solution. Otherwise, it's time to re-install all your apps I suppose.
Click to expand...
Click to collapse
Effectively, I don't know whether I got the exactly same partition name before and after (before ext3 and after etx2).
I have nothing under /root
Actually it is quite strange. I can see my sdcard (only the FAT partitiion) under:
/sdcard2
or
/storage/sdcard1
this is pointing to my external sdcard. I can see the same files/directories in there.
I don't see the second ext2 partition with RootExplorer.
I can see it only with ESExplorer on the lateral bar. It is named sdext2.
I guess that the old partition ext3 was certainly not named the same.
I've just linked new file on the new partition. It is working correctly.
in the data/app folder I see the icon of the new linked app with the correct icon image (it is a game) and a small arrow in the top left correct (shortcut).
in the same folder, I see all the other icons of the lost linked applications with an android image and also the small arrow in the top left corner. But obviously when I tap on it, it says "analysis error,...". I guess that the shorcut points to nowhere because it is not linked anymore.
But I don't where to check where the shortcut is pointing to !! and how to change.
It should be simple to find back the old partition name and rename the new one with same name...
thank you for your help.
clecocq1 said:
Effectively, I don't know whether I got the exactly same partition name before and after (before ext3 and after etx2).
I have nothing under /root
Actually it is quite strange. I can see my sdcard (only the FAT partitiion) under:
/sdcard2
or
/storage/sdcard1
this is pointing to my external sdcard. I can see the same files/directories in there.
I don't see the second ext2 partition with RootExplorer.
I can see it only with ESExplorer on the lateral bar. It is named sdext2.
I guess that the old partition ext3 was certainly not named the same.
I've just linked new file on the new partition. It is working correctly.
in the data/app folder I see the icon of the new linked app with the correct icon image (it is a game) and a small arrow in the top left correct (shortcut).
in the same folder, I see all the other icons of the lost linked applications with an android image and also the small arrow in the top left corner. But obviously when I tap on it, it says "analysis error,...". I guess that the shorcut points to nowhere because it is not linked anymore.
But I don't where to check where the shortcut is pointing to !! and how to change.
It should be simple to find back the old partition name and rename the new one with same name...
thank you for your help.
Click to expand...
Click to collapse
You could try running the script that I mentioned. It won't do any harm. It may be, like you say, that the partition is named differently, so the paths don't quite match up. Duplicating the SD partition path with the script that I linked to, might (and it's a long-shot) let Link2SD see the partition on the path previously set. Let us know if you figure it out.
What was the reason you changed the partition format type anyway?
tillward said:
You could try running the script that I mentioned. It won't do any harm. It may be, like you say, that the partition is named differently, so the paths don't quite match up. Duplicating the SD partition path with the script that I linked to, might (and it's a long-shot) let Link2SD see the partition on the path previously set. Let us know if you figure it out.
What was the reason you changed the partition format type anyway?
Click to expand...
Click to collapse
I'll give it a try asap.
Concerning the reasons... bad reasons unfortunately. The links sometimes were not working. I had to relink regularly the files (hopefully, it is automatic, but not very convenient). Then I though that it may be better in ext2, and you know what happened
I will keep you informed if your advice works.
Thank you very much
tillward said:
You could try running the script that I mentioned. It won't do any harm. It may be, like you say, that the partition is named differently, so the paths don't quite match up. Duplicating the SD partition path with the script that I linked to, might (and it's a long-shot) let Link2SD see the partition on the path previously set. Let us know if you figure it out.
What was the reason you changed the partition format type anyway?
Click to expand...
Click to collapse
Unfortunately, not possible for me. I don't have a custom ROM and therefore don't have /system/etc/init.d in my device.
I will try to reformat bacl my 2nd partition in ext3 and see if I will be able to relink.
I have reformated my partition in ext3.
But after rebooting my device, the mounted name is still sdext2.
Does someone know how to change a mounted partition name without a custom ROM?
Thank you
The script is named init-recovery.sh in /etc.
Finaly, I reinstalled all the apps and copy/paste all the user files manually then relinked to the new partition with link2sd.
Everything is working now.
Thank you anyway for your help
I too am facing similar problem
but i had been using link2sd before and before doing the process i didnt not unlink back to sd card the applications
so now all the files are in miscellaneous folder
is there any way to re link these
i use stock rom

[Q] Replace Internal Data Partition for External SD

Let me start with: I know that there have been many posts on this, but before you get mad, I was unable to find an answer to what I specifically want to do.
For reference: I am a software developer and sysadmin with a decent amount of Linux experience, but not a lot of android specific experience.
Now that the introduction is out of the way:
What I would like to do is completely remove the "USERDATA" partition (the "Internal SD card"), grow the "SYSTEM" partition to fill that space, and then mount my SD Card (external) as the SD Card that the system sees.
I'm currently on Cyanogenmod 10.1 but want to upgrade to 11 soon.
The reason I want to do this is because:
I have all if my apps that I can set to install to SD Card
Both "internal" partitions are full (only about 200MB is available for pictures/etc. and I can no longer update apps)
Camera (and pretty much everything else as well) stores to the Internal SD card by default
If the system partition was 1.1+1.4=2.5GB and all of my apps were "installed" to a real SD card, it would be a lot more comfortable.
So, here's what I am thinking *might* work (maybe not in the right order, though?):
Point the fstab entry for the internal SD card to the external SD card
I have the PIT file. I will delete the "USERDATA " and grow "SYSTEM" to fill the space
When I write it out in steps, it seems pretty simple...
My concerns:
Will a ROM update (to CM11) re-partition back to the old way (and, in the process, break a bunch of stuff)?
I don't ever plan to go back to stock android or change to another ROM (other than upgrades).
Thanks for reading this long post and for any insight you may be able to provide.
--mobrien118
It's a wonderful idea if it works.
Sent from my SAMSUNG-SGH-T769 using xda app-developers app
Modifying partitions is a bit dangerous.
But I have to ask you why do you need another GB of /system storage?
There was a line you can put in the build.prop that flips your ext. SD with the internal one on cm10 I believe.
This'd interest me if I could get rid of usbdisk and sdcard0 merged.
It would need the phone to be repartitioned though, causing issues with the backups and ROMs.
You may even have to compile cm from source.
Its a lot of trouble
Sent from my SAMSUNG-SGH-T769 using Tapatalk
I just did so on S4 Mini with cm-11 Android 4.4.
First I was thinking of using symlinks and/or bind mounts to redirect to the the external sdcard, but that's a bit of a hassle because
1) Since 4.2: both emulated and external storage is mounted with a fuse layer on top not supporting symlinks
2) Since 4.4: no more global write access on external storage
So moving data was the simplest solution. Besides providing (much) more space my sdcard is also around 20% faster in sequential writes: 8.5 MB/s internal vs 10.5 MB/s external. Is it really 2014?
I haven't yet decided what to do with the original data partition, so for the moment I left it unused. Hence I haven't touched the internal partition table.
Quick summary
partition sdcard (gdisk)
I recommend using GPT, this lets you work with partition names rather than numbers. For the sake of still having an "official" external sdcard I made two partitions. Keep in mind that it's usually the first partition which gets automatically mounted as external sdcard. So I made the 2nd partition the new home for data. This partition however has to be manually specified in the ramdisks fstab which involves flashing the boot partition.
format the new partitions (mkfs.ext4)
copy the original /data directory tree to the new data partition
extract initrd from boot.img (abootimg)
extract files from initrd (gunzip & cpio)
replace the /data entry in fstab pointing at your new data partition
re-pack initrd and boot.img (gzip, cpio & abootimg)
flash boot.img onto the boot partition (dd)
If you use recovery, you also have to edit it's fstab (analog to boot.img mentioned above)
done
Alternatively has anyone tried an init.d script? I see those scripts get executed before the mounting of data & sdcard
Meanwhile the original userdata partition got replaced by 3 new partitions: system2, cache2 & userdata2 which are now used for a dual boot ROM.
I've only changed GPT, not PIT. ROMs and Recovery don't use PIT, so as long as Heimdall/Odin isn't involved it should not cause any issues.
Hey guys,
So after read all that, I am also vry interested in what the OP has suggested. I get that the pit doesn't need to be affected, but as the OP asked, when flashing a new rom or updating an existing, would the partition be reformatted back to the way android handles it, ie; back to the system and data seperate and the sdcard not being used as the internal partition?
I am no developer and only have minimal knowledge in linux and android programing, but I am a quick study and any guide to help me sort this would be greatly appreciated.
Also I am about to get a second S4 mini specifcally for doing things like this so if I brick I don't care?
My next question is could it be possible to code the PIT file to do this for you so that you can just flash that through odin, but again would flashing roms affect this.
Cheers,
Sora.
aguaz said:
I just did so on S4 Mini with cm-11 Android 4.4.
First I was thinking of using symlinks and/or bind mounts to redirect to the the external sdcard, but that's a bit of a hassle because
1) Since 4.2: both emulated and external storage is mounted with a fuse layer on top not supporting symlinks
2) Since 4.4: no more global write access on external storage
So moving data was the simplest solution. Besides providing (much) more space my sdcard is also around 20% faster in sequential writes: 8.5 MB/s internal vs 10.5 MB/s external. Is it really 2014?
I haven't yet decided what to do with the original data partition, so for the moment I left it unused. Hence I haven't touched the internal partition table.
Quick summary
partition sdcard (gdisk)
I recommend using GPT, this lets you work with partition names rather than numbers. For the sake of still having an "official" external sdcard I made two partitions. Keep in mind that it's usually the first partition which gets automatically mounted as external sdcard. So I made the 2nd partition the new home for data. This partition however has to be manually specified in the ramdisks fstab which involves flashing the boot partition.
format the new partitions (mkfs.ext4)
copy the original /data directory tree to the new data partition
extract initrd from boot.img (abootimg)
extract files from initrd (gunzip & cpio)
replace the /data entry in fstab pointing at your new data partition
re-pack initrd and boot.img (gzip, cpio & abootimg)
flash boot.img onto the boot partition (dd)
If you use recovery, you also have to edit it's fstab (analog to boot.img mentioned above)
done
Alternatively has anyone tried an init.d script? I see those scripts get executed before the mounting of data & sdcard
Click to expand...
Click to collapse
I just managed to replace my internal sd with the external sd following your ruff guide. thank you very much! At first I struggled a bit getting it to work, because I had encrypted my data partition before -.- this seems to change something in the fstab / mounting / boot-up process, I couldn't get my S4 mini to boot with just changing the fstab.qcom in boot.img. With my recovery (TWRP) it worked from the start editing recovery.img's fstab.twrp /data mount point.
After decrypting(formatting) /data and re-editing fstab.qcom in boot.img it finally works I'm so happy! Enjoying a lot of space on my sdcard now!
usefull threads / information I learnt from:
Partition structure of S4 Mini
Encryption of ExtSD & some fstab information
Editing initrd
abootimg ReadMe
(Links last tried 28.05.2015)

Categories

Resources