Related
When ever I do a nandroid backup i partially backup my system as my "apps" "apps-private" & dalvik-cache" folders are on my /system/sd partition ( /dev/block/mmcblk0p2 ).
To fully backup i need to somehow backup my "/system/sd" along with my nandroid backup.
Now If i copy all the stuff to "/sdcard" I loose all my file permissions, so its not an option.
One option is to use "dd" command which will say something like this
Code:
dd if=/dev/block/mmcblk0p2 of=/sdcard/nandroid/SDBACKUP.img
( the final-full script will generate today's date-time for name etc. etc. )
what will be achieved with this, is that it will create an exact binary copy of the EXT3 partition maintaining all the permissions etc. in that point of time. with same "dd" command you can re flash this img file back to your EXT3 partition.
It all sounds good, but there is a problem and I need someone to help me out here. currently the "dd" which is available in busybox is crippled as it can only handle File->File (byte wise) copy and No Partition -> File or vice-versa .
If anyone out there has a proper build environment ready for building binaries for android( I dont have it set up ) and can build full "dd", I'll be really thankful. you can find dd in GNU Fileutils(If you can build stuff for linux you know where i am pointing you).
If someone has any other ideas to achieve this please comment.
you can do that with adb.
Adb pull /system/sd/* c:\
Or use the ADB File explorer
Then just adb push it back when you need it
why don't you mount /system/sd and /sdcard from recovery and do 'cd /system/sd && tar czpf /sdcard/ext-backup/`date +%F-%I.%M`.tar.gz *'. This backup will be much smaller than your 'dd' backup.
eventually, its needs to be built into nandroid backup.
Seems lovely!
What are the commands to restore this backup (devsk)?
devsk said:
why don't you mount /system/sd and /sdcard from recovery and do 'cd /system/sd && tar czpf /sdcard/ext-backup/`date +%F-%I.%M`.tar.gz *'. This backup will be much smaller than your 'dd' backup.
eventually, its needs to be built into nandroid backup.
Click to expand...
Click to collapse
Any reason we couldn't do this with a command from BetterTerminal or a script from GScript? Looks like you could backup without remounting, but would need to remount r/w to do a similar script to restore from the backup.
Could someone with some programming chops (devsk??) type out the necessary commands for the doing backup and restore from terminal? I would do it, but my skill with linux is not up to it.
Backup for Root Users does this really well. If you choose to, it will back up both the apks and the data associated with the applications so you don't lose any save game progress or preferences and will save it on Fat32 partition of your sdcard so you can just transfer it to your computer for a more secure backup.
Zappza said:
Seems lovely!
What are the commands to restore this backup (devsk)?
Click to expand...
Click to collapse
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/<gzip_file_to_restore>
You need to change <gzip_file_to_restore> to the actual file name which you want to restore e.g. if you want to restore 2009-07-23-06.04.tar.gz to your ext partition, you would do:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/2009-07-23-06.04.tar.gz
This will restore the ext partition backup I took at 6:04pm on 23rd Jul. This code assumes that you have your ext partition mounted on /system/sd and fat32 partition mounted on /sdcard already. If not, you need to say 'mount /sdcard' and 'mount /system/sd' before the above.
Remember that the safest way to backup and restore filesystems is through the recovery console. So, I do a nandroid backup followed by the above tar czpf ('c' is for create) command to backup. This puts my complete backup on the first fat32 partition. Then, I do the reverse (restore from nandroid backup, and fire the above xzpf ('x' is for extract) command to restore my ext partition) to restore a ROM to its working condition.
Thanks this does seem a far better approach . I'll try it and update
My_Name_Is_Neo said:
Thanks this does seem a far better approach . I'll try it and update
Click to expand...
Click to collapse
It is dog slow though! All because of the CPU not able to handle the compression from gzip. It compresses nicely and produces a smaller gzip file but takes a while.
I like where this thread is headed...
subscribed, can't wait to see where this goes.
devsk said:
It is dog slow though! All because of the CPU not able to handle the compression from gzip. It compresses nicely and produces a smaller gzip file but takes a while.
Click to expand...
Click to collapse
I noticed! At first I thought that it did not work at all. Is it possible to disable the compression?
I think removing the "z" from the command and naming the file .tar instead of .tar.gz will not compress it.
My_Name_Is_Neo said:
I think removing the "z" from the command and naming the file .tar instead of .tar.gz will not compress it.
Click to expand...
Click to collapse
that's right. Backup will be faster but bigger. I am looking at another command to see if we can pass a -fast option to gzip.
devsk said:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/<gzip_file_to_restore>
You need to change <gzip_file_to_restore> to the actual file name which you want to restore e.g. if you want to restore 2009-07-23-06.04.tar.gz to your ext partition, you would do:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/2009-07-23-06.04.tar.gz
This will restore the ext partition backup I took at 6:04pm on 23rd Jul. This code assumes that you have your ext partition mounted on /system/sd and fat32 partition mounted on /sdcard already. If not, you need to say 'mount /sdcard' and 'mount /system/sd' before the above.
Remember that the safest way to backup and restore filesystems is through the recovery console. So, I do a nandroid backup followed by the above tar czpf ('c' is for create) command to backup. This puts my complete backup on the first fat32 partition. Then, I do the reverse (restore from nandroid backup, and fire the above xzpf ('x' is for extract) command to restore my ext partition) to restore a ROM to its working condition.
Click to expand...
Click to collapse
Okay, so I saw this thread and decided to repartition my card to resize my ext3 partition to a smaller size and add a swap partition just in case I want to use it in the future. I've been wanting to do this for a while, but have been putting it off because I didn't want to lose all my data on my ext3. So I followed your instructions and I kept getting 'tar: empty archive' errors no matter what I tried (czpf .tar.gz, cpf .tar, cd /system/sd then tar cpf, creating the backup folder beforehand, etc.). So I did some googling and this is what worked for me. This is just an FYI for others who are having trouble with this as I was.
To backup:
mount /system/sd
mount /sdcard
tar cpf /sdcard/ext-backup/backup.tar system/sd
No compression, so it was really quick. It made a ~180mb file in a few seconds. So I opened up the resulting file in winrar and it kept the folder structure and everything e.g. system->sd->contents of sd folder. So I'm guessing to restore, the command would be like this:
mount /system/sd
mount /sdcard
tar xpf /sdcard/ext-backup/backup.tar
I say I'm guessing because I ended up not needing to restore it. I was able to preserve the data on my ext3 partition after the resize. I did however end up having to format my fat32 partition, but I did a backup on that too.
BTW, I'm on Cyanogen's modded recovery.
you got "empty tar" error because you 1. Either forgot to mount /system/sd OR 2. you forgot the '*' towards the end of the cpf command.
You 'tar xpf ..." command is correct for the 'tar cpf ...' command that you typed above.
Note that you need to be in the right directory while creating the backup and restoring it.
test this last commands and it work well, forgot to mention that was made it thru recovery console, hitting the commands with my PC in CMD.
Thanks for the ideas and discussion in this thread... been wanting to set up something like this for a long time but was being lazy.
Have you guys had any luck with the '--exclude' switch on the tar binary that we've got (busybox link, looks like... at least with the Cyan mod that I'm using)?
I haven't done enough testing but it seems like the '--exclude' switch doesn't do anything/is ignored... I was trying to do something like this to ignore the dalvik-cache directory from my backups but it still includes it in the .tar.gz file:
Code:
cd /system/sd && tar czpf /sdcard/backup/systemsd_$NOW.tar.gz --exclude='/system/sd/dalvik-cache' *
(I am setting $NOW to the datestamp string I want with "NOW=`date +"%Y%m%d-%H%M"`" in my shell script)
I haven't tried the '-X' switch with an exclusion file list yet so I might give that a shot but was just trying to see if others played around some more with any of this stuff, etc.
rub1k said:
Thanks for the ideas and discussion in this thread... been wanting to set up something like this for a long time but was being lazy.
Have you guys had any luck with the '--exclude' switch on the tar binary that we've got (busybox link, looks like... at least with the Cyan mod that I'm using)?
I haven't done enough testing but it seems like the '--exclude' switch doesn't do anything/is ignored... I was trying to do something like this to ignore the dalvik-cache directory from my backups but it still includes it in the .tar.gz file:
Code:
cd /system/sd && tar czpf /sdcard/backup/systemsd_$NOW.tar.gz --exclude='/system/sd/dalvik-cache' *
(I am setting $NOW to the datestamp string I want with "NOW=`date +"%Y%m%d-%H%M"`" in my shell script)
I haven't tried the '-X' switch with an exclusion file list yet so I might give that a shot but was just trying to see if others played around some more with any of this stuff, etc.
Click to expand...
Click to collapse
You might be interested in this thread:
http://forum.xda-developers.com/showpost.php?p=4209412
Thanks much for that... nice job with the script.
I guess I need to do a bit more reading though and figure out if backing up the dalvik-cache is actually necessary (doesn't it get (re-)built at first bootup with a new ROM?)... because if not, I'd like to not bother backing it up (and make the backup smaller and quicker in the process).
rub1k said:
Thanks much for that... nice job with the script.
I guess I need to do a bit more reading though and figure out if backing up the dalvik-cache is actually necessary (doesn't it get (re-)built at first bootup with a new ROM?)... because if not, I'd like to not bother backing it up (and make the backup smaller and quicker in the process).
Click to expand...
Click to collapse
I think you have a point. But we may be looking at a very small %age of disk space compared to the overall backup of the phone. Keep in mind that the nandroid backups are not gzip'ed (because it take them forever to do), so there are bigger savings to be had than just saving on the dalvik cache. For example, data.img in nandroid backup can gzipped to 4MB compare to 12MB.
Hi there! I hope it's ok to post here and not in "general"
I've found some scripts about align ext partition.
What do you think about them, are they doing any good thing?
In order of upload:
I think:
1. converts ext3 to ext4 and align file system
2. align an ext4 file system
3. align an ext4 file system and disables journaling for better performance
Developers maype you can study a little those scripts and maybe you can use in roms or in flashing roms...
I tried all of them with twrp 2.2.2.1 and fail it does an error...maybe you can manage and make it work on our devices...
Thank's
I have a Galaxy GIO, which is a fairly old low-end phone. On factory reset, I have about 100MB memory free for apps, and the phone seems to start complaining as soon as I hit the 50MB mark; that's about one or 2 installed applications.
Because I would like to actually be able to, well, use my phone for anything else than calling, I want to move the /data partition to my SD card. I know this'll be slow, but slow still is better than not working at all.
I have done a bit of research, and came around plenty of scripts which claim to mount the second partition of the sd card as /data; none of these scripts work. I have tried 'INT2EXT', 'D2EXT', and I've heard about something called 'A2SD' but I have yet to find a copy of it . To install these scripts I've extracted them, and copied the scripts to '/system/etc/init.d/', after mounting '/system', using ADB.
I for an instant thought maybe my second partition isn't formatted properly, but using adb I am able to successfully mount the ext2 partition as /sd-ext, so I don't see why mounting them as /data should be a problem.
I have also tried to symbollicly link /data to /sd-ext/data and automatically mount my /sd-ext on boot. Obviously this didn't work, because the symbolic link isn't actually saved to disk.
How would I go about moving my data partition to my sd card? I am not affraid of doing some dirty work manually. I am running Cyanogenmod 11.
Binero said:
I have a Galaxy GIO, which is a fairly old low-end phone. On factory reset, I have about 100MB memory free for apps, and the phone seems to start complaining as soon as I hit the 50MB mark; that's about one or 2 installed applications.
Because I would like to actually be able to, well, use my phone for anything else than calling, I want to move the /data partition to my SD card. I know this'll be slow, but slow still is better than not working at all.
I have done a bit of research, and came around plenty of scripts which claim to mount the second partition of the sd card as /data; none of these scripts work. I have tried 'INT2EXT', 'D2EXT', and I've heard about something called 'A2SD' but I have yet to find a copy of it . To install these scripts I've extracted them, and copied the scripts to '/system/etc/init.d/', after mounting '/system', using ADB.
I for an instant thought maybe my second partition isn't formatted properly, but using adb I am able to successfully mount the ext2 partition as /sd-ext, so I don't see why mounting them as /data should be a problem.
I have also tried to symbollicly link /data to /sd-ext/data and automatically mount my /sd-ext on boot. Obviously this didn't work, because the symbolic link isn't actually saved to disk.
How would I go about moving my data partition to my sd card? I am not affraid of doing some dirty work manually. I am running Cyanogenmod 11.
Click to expand...
Click to collapse
I will introduce how to COPY(NOT MOVING) /data partition to /sdcard.
1. You should ROOT First.
2. Use Rootexplorer to Copy /data to /sdcard (WARNING:If your sdcard emulated with /data, Data WON'T copy to SDCARD --You need external Sdcard!)
2-1. if you don't want to use RootExplorer, you can use Android Debugging Bridge(adb)
(Youshould download Android sdks from developer.android.com)
--Command : adb shell su -C cp /data /sdcard/data
3. That's all.
Jason Hyunwoo said:
I will introduce how to COPY(NOT MOVING) /data partition to /sdcard.
1. You should ROOT First.
2. Use Rootexplorer to Copy /data to /sdcard (WARNING:If your sdcard emulated with /data, Data WON'T copy to SDCARD --You need external Sdcard!)
2-1. if you don't want to use RootExplorer, you can use Android Debugging Bridge(adb)
(Youshould download Android sdks from developer.android.com)
--Command : adb shell su -C cp /data /sdcard/data
3. That's all.
Click to expand...
Click to collapse
Thanks, but that's not entirely what I meant. I can manage to move my data to the SD card no problem, but I want my phone to actually use my second partition on my sd card, as the /data partition.
Binero said:
Thanks, but that's not entirely what I meant. I can manage to move my data to the SD card no problem, but I want my phone to actually use my second partition on my sd card, as the /data partition.
Click to expand...
Click to collapse
Oops.. Sorry about that!
First, I am not sure that will work or not, maybe you should try to edit init.*.rc. Which is from boot.mg. I think, maybe mounting sdcard as data is impossible, but you may try editing init.rc(or init.*.rc, * is manufacture). You could unpack your boot img, and you could edit mounting point which is from init.rc!
I hope this thing will help you..
Jason Hyunwoo said:
Oops.. Sorry about that!
First, I am not sure that will work or not, maybe you should try to edit init.*.rc. Which is from boot.mg. I think, maybe mounting sdcard as data is impossible, but you may try editing init.rc(or init.*.rc, * is manufacture). You could unpack your boot img, and you could edit mounting point which is from init.rc!
I hope this thing will help you..
Click to expand...
Click to collapse
I have looked into init.rc, but that only seemed to create the /data mountpoint, but not actually mount to it. I've no idea how to edit the boot image, or what that even is. Is that the filesystem that is built into the kernel?
Binero said:
I have looked into init.rc, but that only seemed to create the /data mountpoint, but not actually mount to it. I've no idea how to edit the boot image, or what that even is. Is that the filesystem that is built into the kernel?
Click to expand...
Click to collapse
Umm.. You should download unpackbootimg or dsixda's Android Kitchen to edit boot.mg. You cannot edit init.rc on Root explore. Use unpack boot.img menu which is from Android Kitchen!
Jason Hyunwoo said:
Umm.. You should download unpackbootimg or dsixda's Android Kitchen to edit boot.mg. You cannot edit init.rc on Root explore. Use unpack boot.img menu which is from Android Kitchen!
Click to expand...
Click to collapse
I'll try that out. Still not sure where to look though. As I said, init.rc does not contain any commands mounting /data.
Binero said:
I'll try that out. Still not sure where to look though. As I said, init.rc does not contain any commands mounting /data.
Click to expand...
Click to collapse
or you could edit look at other *.rc files!
Isn't this what you're looking for?
http://forum.xda-developers.com/galaxy-s2/themes-apps/tool-directorybind-data-to-externalsd-t1410262
sndsnd said:
Isn't this what you're looking for?
http://forum.xda-developers.com/galaxy-s2/themes-apps/tool-directorybind-data-to-externalsd-t1410262
Click to expand...
Click to collapse
I want to mount my sd card to my /data. That simply creates a symbolic link.
Jason Hyunwoo said:
or you could edit look at other *.rc files!
Click to expand...
Click to collapse
There is only 2 rc files, and one of them is specific to my recovery image.
Hello guys. i want to increase my system size so that i can install a larger GAPPS how can i get the PIT file and what is the suitable version of ODiN for me.
Phone Mdel: gt i9105
insternal size is 8gb
MMKamal said:
Hello guys. i want to increase my system size so that i can install a larger GAPPS how can i get the PIT file and what is the suitable version of ODiN for me.
Phone Mdel: gt i9105
insternal size is 8gb
Click to expand...
Click to collapse
You can try to use the guide as you like, but i remember you that you must have philz recovery: http://forum.xda-developers.com/showthread.php?t=2684895
thanks, i will give it a try
Flash old CWRM, connect via ADB, and use "parted". That old parted version bundled doesn't know ext4/f2fs yet, so you have to delete and recreate the partitions instead.
Afterwards fash back to TWRP, and recreate the file systems on the resized partitions. fdisk on TWRP can't manipulate the partition table on Samsung devices.
Keep in mind that you can't change the number of order of partitions, only their sizes. Minimum size for partitions you don't want (e.g. /preload, #20 HIDDEN) is ~4MB, with less you won't be able to create a file system on them, and ROMs attempting to mount the partition will encounter an error.
Ext3h said:
Flash old CWRM, connect via ADB, and use "parted". That old parted version bundled doesn't know ext4/f2fs yet, so you have to delete and recreate the partitions instead.
Afterwards fash back to TWRP, and recreate the file systems on the resized partitions. fdisk on TWRP can't manipulate the partition table on Samsung devices.
Keep in mind that you can't change the number of order of partitions, only their sizes. Minimum size for partitions you don't want (e.g. /preload, #20 HIDDEN) is ~4MB, with less you won't be able to create a file system on them, and ROMs attempting to mount the partition will encounter an error.
Click to expand...
Click to collapse
thanks, can you provide me with more info what commands i need to write as i'm new to thie whole thing
Hello, i have a Redmi note 9S which shipped with Android 10 out of box.. i'm using Dynamic System Updates (DSU) with unlocked bootloader to try custom roms and decided to modify some custom GSI to manually root it and customize some apps (modifications directly to system partition) but noticed that system partition can't be mounted as rw and gives error "wrong fs type, bad option,.." i can only mount it as ro.
I knew that this happens because ext4 partition formatted with EXT4_FEATURE_RO_COMPACT_SHARED_BLOCKS (so called ext4 dedup) and this prevent it from being mounted as rw, trying to extend system.img with fallocate and resize ext4 file system with resize2fs and then use "e2fsck -E unshare_blocks" seems to work but the phone can't boot and trying to create a new rw system.img also fail as device doesn't boot, also i noticed that GSI versions with "vndklite" can be mounted as rw but same thing, it fail to boot when flashed with DSU and the device reboot again to the main OS..
So i have two questions here:
1) is that happens because the device refuse to boot system partition without EXT4_FEATURE_RO_COMPACT_SHARED_BLOCKS as it's already shipped with Android 10 and support this out of box or this happens because of DSU and will boot if flashed with fastboot?
2) and most importantly how can i modify system.img and then apply EXT4_FEATURE_RO_COMPACT_SHARED_BLOCKS (apply shared blocks feature on the file system) like what custom roms developers do so i can boot a modded system partition?
Any help would be appreciated.. Thanks!
same question, did you find answer?