PDA

View Full Version : dd Copy Partitions



PortlandPaw
08-02-2006, 08:30 AM
This process will copy your active partitions to the inactive partitions so that if something goes wrong with the current configuration, the TiVo repair process will bring in the backup team. Or, you can manually flip the boot pages to achieve the same effect. This .tcl program is adapted from several sources including Bubbaj, Riley, Alphawolf, mikey, and ScanMan.

This is a BETA script and is not guaranteed AT ALL! Please have a backup available and proceed at your own risk. This is intended only for experienced and adventurous TiVo hackers!

I've successfully tested it on my Series 1 standalone and Series 1 DirecTiVos and would like to know how it works on other models. Please report your results here and, certainly, indicate any problem or improvement areas.

Basically, what it does is :
1. Determine your active partitions
2. dd them to their corresponding inactive partitions
3. Revises the bootpage parameters, preserving any startup strings
4. Flips the bootpage
5. Revises the file system table (/etc/fstab) on the updated partition to reflect the change
6. Reboots to run from the newly copied partitions

To run ddparts.tcl, simply ftp it to any directory on your TiVo, from telnet cd to that directory and enter ddparts.tcl. If you don't understand the preceding sentence, please do not try to run ddparts.tcl!

PortlandPaw
08-08-2006, 05:27 PM
I guess there aren't that many adventurous souls out there. I'd like to incorporate this into my next hackman release if I can get some confirmation that it works beyond the Series 1.

bradn
01-02-2007, 04:19 PM
Hi David.

thx much for this script! it works **perfectly** on an instantcaked Series 2 Philips DSR704/8 running 6.2. Some suggestions on improving the script:

1) on my tivo the kernel partition copy took longer than the root partition copy. is that normal? if there's any way to provide progress indication with dd that's be quite useful.

2) would prefer to have confirmation before changing boot params and rebooting with the new partitions.

some explanation of why params are different on the 2 dd comands
(bs=1024 for the root partition copy
, bs=1 for the kernel partition copy)


thx again for writing this!!

crashHD
01-22-2007, 08:56 PM
This looks like just the tool I need.

I have a series2 DTivo that I installed with mfslive cd. I used the option to force root partitions to 256MB. When the backup image was restored, the active partition is 256MB in size, according to pdisk, but it's formatted capacity is still the 128MB of the original image. It appears that this tool does automatically what I was planning on doing manually. If I run this, will it format my root partitions at there full size, or will I end up right back where I started, with 256MB partitions formatted to 128MB?

I can't take any chances on bricking this tivo (recordings), but it also has a 768MB /var, so I've got room to make dd images of my partitions and ftp them out to my PC. That would give me what I'd need to repair the drive, in the event something went awry, no? Or should I test this on my spare tivo?

Jamie
01-22-2007, 09:20 PM
This looks like just the tool I need.

I have a series2 DTivo that I installed with mfslive cd. I used the option to force root partitions to 256MB. When the backup image was restored, the active partition is 256MB in size, according to pdisk, but it's formatted capacity is still the 128MB of the original image. It appears that this tool does automatically what I was planning on doing manually. If I run this, will it format my root partitions at there full size, or will I end up right back where I started, with 256MB partitions formatted to 128MB?

I can't take any chances on bricking this tivo (recordings), but it also has a 768MB /var, so I've got room to make dd images of my partitions and ftp them out to my PC. That would give me what I'd need to repair the drive, in the event something went awry, no? Or should I test this on my spare tivo?A dd copy won't resize an ext2 file system. I believe you could do it with ext2resize (http://ext2resize.sourceforge.net) or maybe parted if you pulled the drive and did it on the PC.

Another approach: you could format the alt root and copy everything over there (I'd use a tar pipeline) then flip your bootpage. If anything went wrong, just flip your bootpage back to get back where you started. One thing to remember to do is to edit /etc/fstab in the new root partition to reflect the changed location.

You might ask on the mfslive forums. Other people who have used the new -F option that spike2k added must have been through this and could recommend something.

IcedTivo
02-07-2007, 08:51 PM
Very nice, thanks! Worked good here on Dtivo S1. Always a problem when partitions swap. Sorry can't help with newer versions.

kevin

PortlandPaw
03-06-2007, 08:31 AM
This routine has been worked into the 5.1.0 version of hackman. A lot easier than going the bash route!

mikey
04-18-2007, 02:14 PM
Has anyone had problems restoring a backup after using this? I did, but it could have easily been something else. I did however notice that when using dd if set the count=partionsize, specifically for dd'ing a kernel my backups worked perfectly.
Mikey

Soapm
09-23-2007, 06:49 PM
I want to make sure I have this strait since we'll all be getting an update within the next couple of weeks...

After I get the update I run installSw.itcl making sure to change the file so my Tivo doesn't reboot. I then launch TWP and use hackman to copy the active partition to the inactive partition. This should allow me to boot into my new OS though I may have to reinstall hacks etc...

Will I need to run superpatch or any of that? Should I still be able to FTP, telnet etc...?

mikey
09-29-2007, 09:24 AM
NoNo. DD Copy backs up what is on the active partition.
what you want to do is basically
mod InstallSW.itcl.
run it.
mount the alternate partition and apply hacks to new software version, minimum hacks that is, ie telnet ftpd. If its correct when you reboot it will upgrade. after the upgrade is complete backup using DDcopy. Reboot just to be sure.
finish hacking by adding whatever you want. run the tivo a few days and then backup your fully hacked system again with with DD copy.
Mikey

I want to make sure I have this strait since we'll all be getting an update within the next couple of weeks...

After I get the update I run installSw.itcl making sure to change the file so my Tivo doesn't reboot. I then launch TWP and use hackman to copy the active partition to the inactive partition. This should allow me to boot into my new OS though I may have to reinstall hacks etc...

Will I need to run superpatch or any of that? Should I still be able to FTP, telnet etc...?

Soapm
09-29-2007, 10:17 AM
Thanks... Couple of more questions


mount the alternate partition and apply hacks to new software version, minimum hacks that is, ie telnet ftpd. If its correct when you reboot it will upgrade.

Does the "Copy active to inactive partition" in hackman perform this step?


after the upgrade is complete backup using DDcopy. [quote]

What exact command to you use to perform this DDcopy?

[QUOTE=mikey;288282]finish hacking by adding whatever you want. run the tivo a few days and then backup your fully hacked system again with with DD copy.
Mikey

What exact command to you use to perform this DDcopy?

PortlandPaw
09-29-2007, 10:23 AM
You have to be careful with this operation. Hackman can help, but you have to know what you're doing. Here is what appears when you click "Copy active to inactive partition"


This feature is intended only for experienced and adventurous TiVo hackers! Proceed at your own risk!
This process will copy your active partitions to the inactive partitions so that if something goes wrong with the current configuration, the TiVo repair process will bring in the backup team. Or, you can manually flip the boot pages to achieve the same effect. This routine is adapted from several sources including Bubbaj, Riley, Alphawolf, mikey, and ScanMan.

This process is not guaranteed AT ALL! Please have a backup available and proceed at your own risk. To repeat, this is intended only for experienced and adventurous TiVo hackers!

Basically, what it does is:

-- dd copy --
1. Determine your active partitions
2. dd them to their corresponding inactive partitions
-- flip partitiions --
3. Revises the bootpage parameters, preserving any startup strings
4. Flips the bootpage
5. Revises the file system table (/etc/fstab) on the updated partition to reflect the change
6. Reboots to run from the newly copied partitions


DO NOT FLIP PARTITIONS WITHOUT dd COPYING THE PARTITIONS FIRST!
(or at some point in the past)
So, "mount the alternate partition" is equivalent to flipping them. Good luck!

Shady
07-27-2009, 04:06 AM
I have a Series 2 with 6.4a and the script apparently stops at line 113. Here is a copy of the telnet screen.




Ambers-TiVo# tivosh ddparts.tcl

This process will copy your active partitions to the inactive partitions
so that if something goes wrong with the current configuration, the TiVo
repair process will bring in the backup team. Or, you can manually flip
the boot pages to achieve the same effect. This entry is excerpted from
several sources including Bubbaj, Riley, Alphawolf, mikey, and ScanMan.

The script will inform you as the functions are performed and will then
reboot your machine. Don't touch the TiVo during the process.

This is a BETA script and is not guaranteed AT ALL!
Please have a backup available and proceed at your own risk.
This is intended only for experienced and adventurous TiVo hackers!

What would you like to do?
1. dd copy the partitions
2 Flip the partitions
DO NOT DO THIS WITHOUT dd COPYING THE PARTITIONS FIRST!
3 Quit
Choice? 1
Type "YES" to proceed
Choice? YES

And away we go!

Active boot partition is #4

Now copying active root filesystem partition #4 to inactive partition #7
This will take a few minutes, so please be patient!
dd if=/dev/hda4 of=/dev/hda7 bs=1024
131072+0 records in
131072+0 records out
while executing
"exec dd if=/dev/hda4 of=/dev/hda7 bs=1024"
(procedure "dd3" line 3)
invoked from within
"dd3"
invoked from within
"if {$7active} {
if {! $flip} {
puts "\nActive boot partition is #7"
puts "\nNow copying active root filesystem partition #7 to inactive partitio.
.."
(file "ddparts.tcl" line 113)