yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Shatterv2:
Thanks!

i wiped and reflashed cyanogen then typed in switchrom -r works great!

thanks for your help!
[G1 Android Development] palosjr:
cool. glad you got it working
[G1 Android Development] 3Shirts:
Just wanted to add my thanks for this. I have been running cyanogen roms for time but always tempted to try a hero one even though I use bluetooth a lot. I did a backup with this, played with Mlign rom for a bit then restored cyanogen and it was perfect! Booted straight back how I left it!

Many thanks
[G1 Android Development] chowdarygm:
awesome work.........

small question.... now i am using a King ROM with 2GB card with 32MB linux swap and i want to buy an class 6 8 GB card and will have a 128 MB linux swap on it

now if i take a ROM backup with switchROM when in 2GB card and change the card to 8 GB with 128MB linux swap and restore the previous KingROM, will my ROM use the 128MB linux swap int he new card without any problem????

sorry if this is not the correct place to post, but as i use switchROM to do this, just wanted to know if its possible???

TIA
[G1 Android Development] 3Shirts:
Should work fine since the backup doesn't do anything with the swap space, thats used by the OS which is inactive in recovery mode. The only thing backed up from the card itself is the apps data in the ext partition. As far as I know nandroid just copies the data from the file system so will write it back the same way.

It makes no difference to that process how big the destination is (unless its too small obviously)
[G1 Android Development] pezhore:
I'm having a bit o' trouble with switchrom and CM 4.2.1. Here's my log:

Compress
Using CM421-1027- prefix to create a compressed backup folder
Found gzip, will compress the backup
mounting system and data read-only, sdcard read-write
mount: mounting /dev/block/mtdblock3 on /system failed: Device or resource busy
Error mounting system read-only
umount: can't umount /system: Device or resource busy

I was attempting to do a compress/save of CM421-1027.

I figure the system was already mounted (since the switchrom is in /system/sd/)

Any ideas?

-pez
[G1 Android Development] palosjr:
you have to be in recovery console or in adb shell while the phone is in recovery in order to run switchrom.sh

make sure you are in recovery, otherwise you will get the "device is busy" error
[G1 Android Development] Shatterv2:
If i wipe my ext ext3 partiton and have a ext backup in my switchrom file can i switch between EXt3 and EXT2?
[G1 Android Development] Mookie_Jones:
I question the same thing only because i dont want to lose all of my apps and i want to try hero and the eclair rom.
[G1 Android Development] chrisonline1991:
are you using Amon_RA's recovery? I'm getting the same syntax error that you are getting and thats the only thing i can think of. However Amon_RA's Recovery img is based off cyanogens so i'm not sure. I tried replacing the switchrom.sh a couple times and it still doesn't work. anyone got any ideas?

I guess 3rd times a charm. I redownloaded and replaced switchrom.sh a 3rd time and it worked. I suggest doing the same.
[G1 Android Development] chrisonline1991:
I've downloaded switchrom.txt about 15 times and almost every time i get a different syntax error. Maybe a md5sum would be a good idea? unless i'm doing something wrong?
[G1 Android Development] palosjr:
for you guys using amon-ra's recovery, just drop to recovery console and type in switchrom. you dont even need the .sh file in /system/sd/ .

once you boot in recovery do this

either from the computer (adb shell) or in recovery console

switchrom

(this will bring up the options choose the one you want and have at it!)
[G1 Android Development] isikh:
ON CMod using amon ra's recovery 1.2.2 I keep getting "can't open '/system/sd/switchrom.sh' "

THANKS!
[G1 Android Development] NguyenHuu:
for us magic users who dont use apps2sd or have an ext partition, is there a way to mod the script to work and save backup to sdcard?
[G1 Android Development] Shatterv2:
Flah the 1.2.3 recovery bud.

then type in switchrom -r
[G1 Android Development] isikh:
I got it, but thanks. I like 1.2.2. I like the partition default
[G1 Android Development] _Kyros_:
Why do I have to keep moving switchrom.txt to /system/sd everytime I bookmark a new ROM? Am I supposed to keep doing this or am I doing something wrong?
[G1 Android Development] jklong03:
Thanks

Thanks for the tip, I was about to start trying to reverse engineer the script since I am running amon-ra !!

Did the adb shell method while in recovery console and it worked great! :)
[G1 Android Development] Joe333x:
That would be the same as using nandroid, all this script does is make a nandroid back up plus the ext partition. So just use nandroid.

if you uses RA-dream-v1.2.3 recovery the script is built in.
[G1 Android Development] _Kyros_:
http://images.google.com/url?source...ap.gif&usg=AFQjCNHVB82fk705ZCyyCw6HvuLM8lNF_w

I was just typing switchrom then -s...now I got it. Thanks guys. :D
[G1 Android Development] NguyenHuu:
i know that is what it does but it also lets you assign names to the backups and also lets you choose which backup you want to restore. with nandroid you cannot assign titles and it only restores the latest backup, u cant choose...
[G1 Android Development] palosjr:
use BART- Backup And Restore Tool, its in the development thread
[G1 Android Development] NguyenHuu:
i tried both, they are both included in the recovery mode. but both give me the same problem. because i dont have an ext partition. it always fails to mount /system/sd when i run the script. any way to mod the script to work without ext partition?
[G1 Android Development] dumfuq:
sorry but nandroid requires that sdcard is not mounted when it is initiated. the only option you have is to tweak the nandroid script. Or I guess you could tweak switchrom or bart but you would still have to repack your recovery image so the scripts were not on your sdcard. nandroid does let you name the roms and restore specific roms through the command line as well but its not as user friendly as switchrom or bart.
[G1 Android Development] Joe333x:
if you read the examples on the bart page there is a command that will back up nandroid only and allows you to choose a name also
[G1 Android Development] dumfuq:
It still probably won't work because switchrom and bart both try to mount ext and sdcard during their sanity checks. I can fix it in bart soon but since you don't have an ext partition it will still need to be packed in a recovery image. If you don't know how to pack your own recovery, I suggest you read up on that or otherwise you will have to wait for someone else to pack it.
[G1 Android Development] jerzy448:
this script is the best.
[G1 Android Development] housecat93:
I'm obviously a noob!

Hey guys, sorry if this question seems N00bish... But when I rename the text file to switchrom.sh it simply tells me it cant read the file when im in the recovery console... I Figured out that I need to change it from .txt to .sh ... But how do I do that? :D
[G1 Android Development] hyperandy:
Rename

You can either use the cp or mv command, linux doesn't rename directly

example:

cp /sdcard/foo.txt /sdcard/foo.sh

I haven't installed this yet but most scripts you also have to make executable, i.e. chmod 0755 foo.sh

hope that helps
[G1 Android Development] AbsoluteDesignz:
man...I love this...its absolutely amazing...I hope someone can include this in a recovery image one day...
[G1 Android Development] Chahk:
I believe Amon_RA already has. BART (which is based on switchrom) is accessible from the main recovery menu.
[G1 Android Development] billquinn1:
choose "console" from the recovery menu

hit enter and then type "utility"

the bart choices are in this menu with some other stuff I can't remember.
[G1 Android Development] palosjr:
there are now two ways to get switchrom running on your phone.

1) flash amon-ra's recovery, drop to recovery console type switchrom and follow the list of options.

2) copy switchrom.TXT to system/sd/ this can be done two different ways.

either copy the .txt file to the root of your sd card and then in adb shell or recovery console do the following

this will move the file
mv switchrom.txt /system/sd/switchrom.sh

this will copy the file, and rename it.
cp switchrom.txt /system/sd/switchrom.sh

another way to do it, is enable file extensions in windows. rename the .txt extension to .sh and then adb push the file to /system/sd/

there is no need to do any chmod for this script.
[G1 Android Development] digitallysick:
Can someone explain to me how this works and why we would use it? Its my understand its the same as nandroid plus extra functions? meaning, if we back up with switch rom, and flash a new rom, later if we change back, we can just restore via switchrom, which restores the rom and settings? or am I very wrong?

Sorry the directions about what is does is not clear at all
[G1 Android Development] palosjr:
think of this as a game save, or like a save as to a file.

you save as, work on the file, or create a new file... later on you decide that your new work isnt as good as your previously saved document. so you open the original file that you liked and go from there. make sense?
[G1 Android Development] digitallysick:
So this is used instead of nandroid, for restoring?
[G1 Android Development] palosjr:
yes. although, this method uses nandroid, but it also backups everything else. ext2/3/4 and all.
[G1 Android Development] josedecuba:
please help Question about mytouch 3g

:confused::confused:I'm no0b,and this sounds good but I have a question how can I use this in a phone mytouch3g due to no keyboard to go into nothing , I know this sound like ......but I already have v 1.2.3 .can someone explain what is my best solucion .and thank
[G1 Android Development] chowdarygm:
i have been using switchrom from amon recovery and it was working fine but today when took a backup and trying to restore, its failing to restore....... any ideas???
[G1 Android Development] tee aiy emm:
I think you can use Better Terminal which can be found in the market, or you can connect your phone to your computer and use adb shell
[G1 Android Development] :
PLEASE someone put this into cyanogen's recovery image... need a GUI for that.. and life would be perfect. Have a gaming rom, a rom to show off for friends, a super fast rom, etc... If you guys want to leverage the ROM community.. add this to the Cyanogen's recovery and this will take off.
[G1 Android Development] palosjr:
its already in amon-ra's recovery, which is based on cyans recovery.
[G1 Android Development] billyjr2:
unclear about wiping

Sorry for asking but the instrutions say not to wipe ext

.but I read this whole message board and I seen apost wear

You said it was ok to wipe ext .theni seen anther post wear

You said not to wipe because we will loose everything.

I've used this and it works good but I ran across a few roms wear

It says to wipe ext .......so can I

Wipe

Wipe ext

Repair

Flash...............or

Wipe

Wipe devk

Repair

Flash

Or

Wipe

Flash

And when flashing back to a stored rom do I have to wipe at all

I have the. Ammon-ra-newest recovery ,swithrom and bart

1 more thing if I happen want to wipe and remove the bart and

Swithrom.sh ,can't put them back on.aren't the roms stored on sd

Card.I noticed a swithrom folder on my sd card.......sorry so long

Thank you .....
[G1 Android Development] digitallysick:
This is nice, we need to get this built into the recovery screen
[G1 Android Development] chowdarygm:
Its already there in RA 1.2.3 recovery ... :)
[G1 Android Development] Shatterv2:
No he means like in the actual ROM menu not in the console.
[G1 Android Development] sim64one:
Work fine

I like to submit my feedback to your script.

It is not for newbe, but it is a very goog way to have a clean restore.

The only thing is to remember to copy switchrom.sh to system/sd every time you make a new installation.

Thanks for your work.

:cool:
[G1 Android Development] badmonopoly:
I'm confused haha. Nandroid does full backup with EXT, now.
[G1 Android Development] badmonopoly:
I'm confused haha. Nandroid does full backup with EXT, now.

And I see you're using it...
[G1 Android Development] sim64one:
yes, but I've had some problems after a nandroid + ext restore and bart too.

... and more, with this script I can see the exact name of each backup and no make confusion or mistake.

These are the reasons I'm actually using switchrom.

Thanks again
[G1 Android Development] Shatterv2:
I dont see how that makes sense. Bart is based off of switchrom. Practically built from it I think. Use amon recovery the latest, and type bart -s (mjdsgfskjg)

Thats the actual bart back up not the one in the menu. :p:p:p:p
[G1 Android Development] devsk:
You are using it for the right reasons. It was written to make it easier to switch, just with a name! No 20 thousand options to sift through! No figuring out if this or that gets stored or not. Just plain and simple named full image!
[G1 Android Development] devsk:
Yup. That's right! Although, I still use switchrom myself....;-)
[G1 Android Development] Shatterv2:
Thats bart too.
[G1 Android Development] dj westie:
Get error saying can't move file??

Any sugestions??

Tried moving it with astro & androzip..

No luck?

Any idea's??
[G1 Android Development] devsk:
You will have to cut&paste the exact error. Otherwise, we are shooting in dark.
[G1 Android Development] dj westie:
Could not move file due to system resrictions.

Is that good enough??

Cheers
[G1 Android Development] staunty:
I had switchrom installed but it seems the file has been updated recently? I am trying to reinstall it but am having problems. I keep getting told its a read-only file system. Plus, I also just got a "Cross-device link" error when running:

mv switchrom.txt /system/sd/switchrom.sh

I've never seen a cross-device link error...
[G1 Android Development] billygoat555:
Questions

Well, I've tried using switchrom and it hasn't worked for me. I don't know what I'm doing wrong. I have four ROMs saved to my sd card. When I type "switchrom -l", they all show up.

When I try to restore one of them, one of two things happen. Either it gives me a nandroid error (which I have seen posted before) or it says it is all restored and when I reboot, it gets stuck in the G1 screen and doesn't move forward. Eventually I end up not being able to restore anything and have to wipe and install everything from scratch.

I read the whoooooole thread but couldn't find anyone with the same problem. Hope someone can help.
[G1 Android Development] billygoat555:
One more thing

Can someone also write step by step instructions on how to save and restore the ROMs? I have watched 3 different videos on youtube and it still doesn't work for me...see above as what errors I'm encountering..thanks for the help!
[G1 Android Development] SMS007:
Restore just apps?

Is there a way restore the ext partition (just the apps) without restoring the nandroid backup?
[G1 Android Development] jooooooon:
I Have a similar problem and dosen't work switchrom.

my Sdcard 2GB

swap linux part=64mb

ext3 512mb

and fat32 remainder
[G1 Android Development] devsk:
I have played with 4 ROMs in last 3 hours and I want to get 2nd one back because it was the most beautiful, most stable and the best thing since sliced bread. how do I know which timestamp in nandroid does it correspond to? We need tagging of backups, not the timestamps which are in UTC time (doesn't match your local time, unless you are GMT).
[G1 Android Development] ccunningham83:
Okay, That makes a lot more sense. Now I understand the desire to run this. I knew I was missing something. Thanks.
[G1 Android Development] devsk:
That's normal. The script is running from /sdcard, so it won't be able to unmount /sdcard. I left it in there because eventually this code may be subsumed by the cyanogen's recovery menu and that operation needs to be complete.
[G1 Android Development] Deuces:
would love to see this script built into the CM 1.4.1 Recovery
[G1 Android Development] johnnylicious:
I believe cyanogen said he will include this script into the next recovery image update =D
[G1 Android Development] devsk:
Did he say that?
[G1 Android Development] johnnylicious:
well i don't wanna quote him forsure that he did but snoopin around somewhere on xda he did note that he could possiblity include this script in his next update with your permission of course, since the new recovery image 1.4.1 doesn't include choosing different nandroid backups to reflash but yeah.

:)
[G1 Android Development] kizer:
Ok a few things I noticed just incase anybody wants to see the output.

1. Run nandroid like normal because well you have to have a nandroid zip to do the magic.

2 enter into console and run the script. I chose cm3.6.5 which is the rom I'm running.

3. It appears to create a switchROM folder with the following.

switchROM/

cm3.6.5/

- ext-backup.tar

nandroid/

20090716-1509/

- boot.img

- cache.img

- data.img

- misc.img

- nandroid.md5

- recovery.img

- splash1.img

- splash2.img

- system.img

So for every Rom I install and create a nandroid I can rebuild using your script which appears to be rather slick. I haven't tried to rebuild from it yet.
[G1 Android Development] devsk:
He doesn't need my permissions....:) He can just inform me. And hopefully credit me for it....:D:p;):)
[G1 Android Development] johnnylicious:
lol! im pretty sure he credits all devs who he uses their material / code =D

thanks again for this AWESOME script! wonder what else this can be made into hmm
[G1 Android Development] devsk:
That's pretty much it! What you get is a recording of all your complete ROMs, apps and settings. You can easily restore from this with just a name.
[G1 Android Development] Deuces:
Been building multiple roms, loving this script, a couple ideas:

GUI

File Management

File Management - add ability to remove and rename backups

have this cleanup files in the nandroid folder as well

perhaps even merge switchROM directory with nandroid directory

seems like a large portion of free space is being wasted here

wouldnt mind but its over 100mb (referring to duplicate nandroid backups that are copied by script to \switchrom\)
[G1 Android Development] My_Name_Is_Neo:
Well i think not much should be expected for GUI as the file manipulations are going on in the SD card and you can use Astro or mount it on ur PC to do all the manipulation. You can remove the Nandroid backup as a copy is already stored in SwitchROM folder, if space is a concern.

Command prompt based file management is not very intuitive for most. But I am not opposing any new features :P

It would be great if This script was included as a separate button or part of Nandriod backup it self. I still dont know how will it take keyboard commands for ROM Names. for G1 its not a problem but for phone which do not have physical keyboards it will be a challenge. on a second note Cyan's recovery image is for G1 only for now.
[G1 Android Development] Deuces:
i agree with you on GUI - was just a thought, something with menus like cyans recovery image would make this sucker just too cool for school.

ive been manually removing the nandroid folder for the space, its not an issue its just a habit.
[G1 Android Development] My_Name_Is_Neo:
@devsk

I see that you have done nice use of the tar command here. :P. from the solution you gave me from the other thread. I love this script. it does everything i need.

But there is one thing you need to change. You try to unmount the /SDCARD at the end, the script is runnig from sdcard itself and it refuses to unmount as it is in use. Someone might think that as an non-trivial error. Unless it gets incorporated into Recovery image itself as a script or otherwise, please remove the unmount of the /sdcard. unmounting /system/sd is fine though.

Thanks again.
[G1 Android Development] overground:
Just tried this, and well, the backup seems like it worked perfectly. You may want to update your first post about the unmount error being an expected occurrence...thanks very much for this.
[G1 Android Development] devsk:
I initially thought that I should move the specific directory from nandroid backup instead of copying, but on second thought I decided against it thinking that nandroid should be left alone in case user finds it odd that his nandroid backups have disappeared from their usual location. But I think (second thought on the second thought), its probably ok to move the folder because whoever installed this script already knows that I am moving stuff from nandroid folder to /sdcard/switchROM/ folder.

As for a GUI, I think a single restore menu item in recovery menu, followed by a list of ROMs which you can scroll through and select will be awesome.Only cyanogen can make that change. And if he integrates this script with nandroid and makes ROM backup and restore transparent, that would be golden!

I have ideas about generating sane names for the "store" part automatically, so that can be just a single menu entry "Backup my current ROM" without any inputs (may be a confirmation with Home button).

what say you cyanogen?
[G1 Android Development] devsk:
Yeah, another user had pointed it out as well. So, I heeded to the advice I edited the first post. I will make that error go away in the next version.
[G1 Android Development] My_Name_Is_Neo:
There is one more thing i wanted to point out. Backup process tar's the whole /system/sd but restore part deletes only /system/sd/app* & /system/sd/dalv*.

why not delete everything that is on /system/sd before extracting the tar?
[G1 Android Development] devsk:
This was also another design decision I had to make. This is not a really a format of the partition. So, if the user has put some other data on there like his personal userinit.sh or some other stuff which he wants on his ext partition (like something which he wants hidden with proper permission controls instead of fat32's "everyone is watching" approach), the script should respect that. That's why it deletes only the parts which affect the behavior of the ROM but restores all the data that was originally on the partition. I consider this a feature....:D:p;)

BTW, keep the comments coming. I really like this.
[G1 Android Development] xyrcncp:
Maybe I didn't read the thread correctly, but this would be my first time using switchrom. I tagged my current ROM. If I want to go to another ROM, I just wipe everything as usual via Amon_RA Recovery, data/cache, dalvik and ext3 or leave dalvik/ext3 alone?
[G1 Android Development] inkblot007:
invalid tar magic

I also have the exact same problem. Does anyone else have this issue - or even better, a solution? I have plenty of space, at least 10 times the amount.
[G1 Android Development] inkblot007:
invalid tar magic

Originally Posted by funnycool View Post

I have a problem when I restore my backup:

/ # switchrom -r

switchrom -r

1. donut16

Choose a ROM (type in the number and press enter)...1

1

Restoring ROM donut16, proceed? (y/n) y

y

Cleaning up /system/sd ...

Restoring donut16 app data in /system/sd ...

tar: invalid tar magic

Error occurred during restoration of app data...

tar operation failed.

Do you have enough space on the /sdcard?

How Can I do???

Thanks!
[G1 Android Development] Ch4m3l30n:
Does the 1st requirement in the first post still remain a requirement? If so, that may explain your problems...
[G1 Android Development] Mumps:
I have one issue:

From cmd in Windows, I do:

adb shell

mount /system/sd

It says:

mount: can't find /system/sd in /etc/fstab

I'd like to edit the fstab, but I don't know the exact way. I'm trying now with:

/system/sd	/system/sd	yaffs2	rw

But somehow doesn't seems right, putting /system/sd twice... (can you mount a folder into itself?)

Also I've tried doing an adb remount before going into adb shell, and do the "sh /system/sd/switchrom.sh -s" but obviously it says "Unable to mount /system/sd"

Is there another way?

I really like to use switchrom, so I don't have to rename the folder BART creates. Also you can use this from windows without going to recovery (can you do a BART through adb shell?)

I know it's several issues, many thanks!