yashsingh1/xdaforums huggingface dataset:
[Shield Android TV General] hallydamaster:
Well, unless you want to build it yourself, I can probably build the lastpart.bin, updating the partition array and GPT header to a specific disk size.

It's going to take some time since it's manually hexediting of the array of partitions 16-32, but I would probably be able to have something ready in the evening. What disk size do you want to use?
[Shield Android TV General] hallydamaster:
Oh, I forgot. You made that auto patcher. Couldn't you just make it rewrite the partition start/end pointers automatically? Then it's only a matter of rewriting the partitions from 16-32 to align them.
[Shield Android TV General] anchung.chen:
Yes, I will modify the auto patcher program to test it. It would save lots of efforts of hand-editing.
[Shield Android TV General] anchung.chen:
Yes, It works. I use 128G SSD for testing the 4K alignment and it works normally. Does anyone like to test for any speed difference between 4K-aligned and non-4K-aligned SSD ? But I think it is better to make it 4K aligned.

Attached program is for 64-bit Linux PC.

Here is the program's output:

./shield_pro_new_disk_gpt_calculator-0.3 satv_pt_gtp_skip_976773158.bin 128035676160 M4-CT128M4SSD3.lastpart.bin

Shield-pro-500G gpt-calculator for new SSD/HDD disk, ver. 0.3, with 4K alignment.
Thanks to Luxferro and hallydamaster at xda-developers nVidia-Shield-Android-TV Shield-Android-TV-General forum.
See 'Guide: Migrate to SSD/HDD of any size, only for SATV Pro 500GB'

new_disk_byte_size = 0x0000128035676160
new_disk_sector_size = 0x000000000ee7c2b0
new_disk_current_LBA = 0x000000000ee7c2af
new_disk_last_usable_LBA = 0x000000000ee7c28f
new_disk_start_partition_array_LBA = 0x000000000ee7c2a6
new_disk_data_last_LBA = 0x000000000ee7c28e
New partition #16 First-LBA=0x0000000000011100 Last-LBA=0x00000000000120ff
New partition #17 First-LBA=0x0000000000012100 Last-LBA=0x00000000000130ff
New partition #18 First-LBA=0x0000000000013100 Last-LBA=0x00000000000530ff
New partition #19 First-LBA=0x0000000000053100 Last-LBA=0x000000000005fcff
New partition #20 First-LBA=0x000000000005fd00 Last-LBA=0x0000000000061cff
New partition #21 First-LBA=0x0000000000061d00 Last-LBA=0x000000000006e8ff
New partition #22 First-LBA=0x000000000006e900 Last-LBA=0x000000000046e8ff
New partition #23 First-LBA=0x000000000046e900 Last-LBA=0x00000000004ee8ff
New partition #24 First-LBA=0x00000000004ee900 Last-LBA=0x000000000066e8ff
New partition #25 First-LBA=0x000000000066e900 Last-LBA=0x000000000066f8ff
New partition #26 First-LBA=0x000000000066f900 Last-LBA=0x000000000067f8ff
New partition #27 First-LBA=0x000000000067f900 Last-LBA=0x00000000006808ff
New partition #28 First-LBA=0x0000000000680900 Last-LBA=0x00000000006848ff
New partition #29 First-LBA=0x0000000000684900 Last-LBA=0x00000000006888ff
New partition #30 First-LBA=0x0000000000688900 Last-LBA=0x00000000006908ff
New partition #31 First-LBA=0x0000000000690900 Last-LBA=0x00000000006948ff
New partition #32 First-LBA=0x0000000000694900 Last-LBA=0x000000000ee7c1ff
crc32_partition_array = 0xc42a048d
crc32_gpt_header = 0x8b813cf8
Done!!!
'sudo dd if=firstpart.bin of=/dev/sdX bs=512 count=69888' to write partion #1-#15 to new disk
'sudo dd if=firstpart.bin of=/dev/sdX bs=512 skip=69790 seek=69888 count=6830080' to write partion #16-#31 to new disk
'sudo dd if=M4-CT128M4SSD3.lastpart.bin of=/dev/sdX bs=512 seek=250069670' to write to new disk
In fastboot mode, 'sudo fastboot oem unlock' and confirm in fastboot menu
or In fastboot mode, 'sudo fastboot erase userdata'
In fastboot mode, 'sudo fastboot format:ext4 userdata'

Just found that running the "sudo fastboot oem unlock" command, it finished without error, and no problem in Android. But enter fastboot mode again, and using "sudo fastboot flash" command, it said bootloader is still locked.
[Shield Android TV General] hallydamaster:
Thank you for the input, I'll put it up in the second post or something whenever I have the time, to incorporate it in the guide somehow.
[Shield Android TV General] hallydamaster:
Hi there, I am about to incorporate the alignment part of the process into the guide, could you please tell me if you have had any problems regarding the OEM unlock part? Is your device still locked, and how was the state of the bootloader before you put in the SSD? Was is locked or unlocked?

Just curious about the details, wouldn't be good not to be able to unlock your device after doing this?

Would be great actually if anyone else who did this could share some insight as to whether their devices are locked or not? Or even unlockable after this mod? :eek:
[Shield Android TV General] anchung.chen:
Sorry, I should make it more clear. I backup my SSHD in OEM locked state, and use this dd image for restoring to new SSD with my modified 4K aligned partition entries. I then issue "fastboot oem unlock" in fastboot mode, and it report ok. But after reboot to fastboot mode again, I found it is still in OEM locked state. And the new SSD works well in Android.

In this bootloader locked state, I replace the SSD with another SSD which is unlocked before without 4K aligned partition entries, and boot to fastboot mode, it is reported to be in unlocked state. So the lock status of the bootloader should be record somewhere in the SATA hard drive.

Maybe I should unlocked the bootloader of SSHD first, and use it's backup image for the test of 4K aligned partition entries.
[Shield Android TV General] hallydamaster:
That is really interesting. Wonder if it has something to do with the smaller sized SSD, maybe fastboot is searching for something in the end of the disk. Maybe a predefined offset?

Or maybe it had something to do with moving all the partitions?

I'm gonna put the 4K alignment part up soon, then other users might chime in.
[Shield Android TV General] Luxferro:
Supposedly the /persistent partition stores data on the boot loader unlock status, at least according to here: http://newandroidbook.com/Articles/Nexus9.html

Offhand, I don't recall where/how I came to the conclusion that RP2 is the /persistent partition, but when the device was locked RP2 was filled with all zeros. Not sure if it changed after it was unlocked.

But I don't think you guys should be messing with the start and end points of any partitions before /data, even they aren't 4k aligned. It will likely break updates too, as they don't patch on file level anymore - and are patched at block level, so if data is shifted around, I don't see how that would work.
[Shield Android TV General] hallydamaster:
First post has been updated with details to use the guide with DD for Windows.
[Shield Android TV General] hallydamaster:
That's a very good reason not to do that, good input though. Going to put it in the guide later on, some users might still be worried about 4K alignment! :)
[Shield Android TV General] hallydamaster:
Decided to take a quick look at the RP2 partition of my unlocked SATV. The last byte in the partition is 01 (hex), so it seems to be the only change. But I don't have a locked version to compare with.
[MENTION=7254357]anchung.chen[/MENTION]
[Shield Android TV General] ahmed68:
dear hallydamaster

I boot from emmc but I must flash hdd with boot.img and dtb (tegra210-foster-e-p2530-0930-e02-00.dtb) from nv-recovery-image-shield-atv-3.2.0 once I boot to Ubuntu by sd card and open all part of emmc found the log file and there error unnon dtb file from emmc I cant boot in fastboot mod , now I try to correct that when I flash hdd the stok dtb it come unbootabele but if flash it dtb from Linux for tegra and boot.img wish I make for l4t its work I well try this one mebay it well work without hdd or need a modefed dtb like this

http://www.eevblog.com/forum/reviews/teardown-nvidia-shield-tv/msg944285/#msg944285
[Shield Android TV General] anchung.chen:
I replaced the original SSHD with KINGSTON SMS200S3240G SATA 6Gbs SSD, and surprised that the SATA Link speed in only 3Gbs with official L4T R24.1 kernel running official L4T Ubuntu.

ubuntu@tegra-ubuntu:~$ cat /sys/class/ata_link/link1/sata_spd
3.0 Gbps
ubuntu@tegra-ubuntu:~$ sudo dd if=/dev/sda32 of=/dev/null bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 4.31382 s, 243 MB/s

Is it Kernel or SOC Limitaion ?
[Shield Android TV General] hallydamaster:
Guide updated with information and steps to align partitions for 4K sectors.
[Shield Android TV General] hallydamaster:
I wonder if the SATA interface can deliver juice enough for the SSD to give the best performance?
[Shield Android TV General] anchung.chen:
Hi hallydamaster:

Just like to clarify that official OTA update works for my 4K aligned SSD mod. I can update to Nvidia 3.2 firmware without any problem.
[Shield Android TV General] ahmed68:
I try 4K aligned SSD mod then I cant root via twrp and supersu and I cant boot to Linux return to shield_pro_new_disk_gpt_calculator all work I think not all ssd seem .
[Shield Android TV General] hallydamaster:
That is great to know, I'll change it in the guide ASAP. Seems like it still breaks some other stuff though.

Thank you for your findings, I'll put it in the guide.
[Shield Android TV General] ahmed68:
i think the problem in the power supply unit , Tegra X1 support sata 3 and tegra x1 jetson work in sata 3 6gb/s i flash dtb from jetson L4T but speed dont change .

sshd need 5v...0,70a and ssd need for full speed 5v....1,4a thats for samsung evo 500gb , from nvidia we can downloud data sheet for jetson and see wish chip use for psu but data sheet for shield i cant find.

mebay we can replace the power chip with think like jetson x1.
[Shield Android TV General] ahmed68:
this the emmc clone img the bootloader not work all other work to start android flash hdd boot.img and dtb from satv (nv-recovery-image-shield-atv-3.2.0) when see NVidia you can unplug the hdd . don't flash the blob otherway the hdd come to apx.

I clone it from hdd then update it by ota in the recovery then make factory rest anybody can help to make bootloader work.

here the photo and the site thanks .

https://mega.nz/#!F9hjDDbB!wL821sNr8pJ6WraeoyHDH8emAgZXymG7xT86Gc9pkhg
[Shield Android TV General] yahoo2016:
SATV Pro may have boot ROM hard coded to only boot from HDD.

From this link:

http://http.download.nvidia.com/tegra-public-appnotes/tegra-boot-flow.html
[Shield Android TV General] ahmed68:
thank you yahoo2016

I reed in http://http.download.nvidia.com/tegra-public-appnotes/tegra-boot-flow.html I think I haven't chance to boot from emmc .
[Shield Android TV General] neilhoward84:
Internal HDD File format?

Great post guys quick question?

I need to replace my internal 500GB HDD as the old one is dead. I will be using the .bin files that were posted originally by [MENTION=7386697]Tilator[/MENTION]. The only question I have, is what file format shall I format the new internal drive need as?

Or is this irrelevant as the DD command will be copying block data?

I'm a Mac/Windows user so cheers for guide on using Windows for DD
[Shield Android TV General] hallydamaster:
You will not need to do any partitioning. This procedure writes the partition table and header. Drive will appear as Nvidia proprietary GPT afterwards.

Would be good to get some input about DD for Windows, haven't tested if it actually works.

But isn't DD natively in Mac? :)
[Shield Android TV General] swatwithmk3:
Hi,

i bought the shield pro but the original hard drive crapped out so i dont have it anymore and all i want to do is replace it i have a 128 gb ssd which i would prefer to use but if not possible could you give me instruction on how to do it with a 500 gb hdd since i cant actually boot the shield into fastboot cuz no drive.
[Shield Android TV General] yahoo2016:
If your original SHDD is completely died, you can try:

http://xdaforums.com/shield-tv/development/nvidia-shield-tv-ssd-t3402580

That approach does require HDD of the same size as original (500GB).

If you can still recover some partitions (the partitions with device dependent data) of your original SHDD using DD, you may be able to reconstruct your HDD using OP's approach.
[Shield Android TV General] swatwithmk3:
Unfortunately it completely died and wouldnt even power on so i cant access it at all and also it would be nice if this guide would be simplified as i am a simpleton who does not speak super smart also im using windows 10 and when i enetered the bytes of the 120 gb ssd into the spreadsheet it gives me an odd number of hexadecimals.
[Shield Android TV General] yahoo2016:
Then you have to use the approach from:

http://xdaforums.com/shield-tv/development/nvidia-shield-tv-ssd-t3402580

There are instructions in the link.
[Shield Android TV General] yahoo2016:
I was able to write only the first 20 partitions (<300MB) and the last part (5120 bytes) to a new HDD, boot to fastboot recovery mode, flash new boot image to partition 21 ("/boot") and boot to ubuntu..

fastboot recovery mode should work for "flashing" stock SATV Pro ROM. Serial number/Mac address won't be correct.

To my surprise, it appears I can use the first 20 partitions from different SATV pro to boot to fastboot recovery mode. It appears SATV Pro does not use unique Secure Boot Key for each SATV.
[Shield Android TV General] yahoo2016:
I used a SATA extension cable to test different HDD/SSDs (see photo), the results are below, i.e., SSD and internal eMMC are more than twice as fast as SHDD.

sudo hdparm -Tt /dev/sda32

250GB EVO 850 M2 SSD:
/dev/sda32:
Timing cached reads: 4288 MB in 2.00 seconds = 2144.99 MB/sec
Timing buffered disk reads: 778 MB in 3.00 seconds = 258.96 MB/sec

500GB SATV SHDD:
/dev/sda32:
Timing cached reads: 4152 MB in 2.00 seconds = 2077.49 MB/sec
Timing buffered disk reads: 286 MB in 3.00 seconds = 95.20 MB/sec

100GB Seagate Momentus 7200.1
/dev/sda32:
Timing cached reads: 4028 MB in 2.00 seconds = 2015.16 MB/sec
Timing buffered disk reads: 108 MB in 3.03 seconds = 35.65 MB/sec

32GB micro SD:
/dev/mmcblk1p1:
Timing cached reads: 3792 MB in 2.00 seconds = 1897.40 MB/sec
Timing buffered disk reads: 114 MB in 3.02 seconds = 37.71 MB/sec

16GB internel eMMC
/dev/mmcblk0p1:
Timing cached reads: 3792 MB in 2.00 seconds = 2248.46 MB/sec
Timing buffered disk reads: 114 MB in 3.02 seconds = 211.59 MB/sec
[Shield Android TV General] hallydamaster:
Really great inputs, I hope this give people more the reason to give this a try!

I was thinking about putting a small ssd in myself and use a NAS as the storage solution. As it is now I'm getting low on the built in 500 GB storage.
[Shield Android TV General] Marski1969:
Hi! and tnx for this guide:)

I try to follow the guide DD for Windows and did the part where i create a backup from firstpart.bin

dd if=\\?\Device\HarddiskX\Partition0 of=firstpart.bin count=6899870

It creates a firstpart.bin file like 3Gb+ big. (30min ready)

After thats i did lastpart.bin with code:

dd if=\\?\Device\HarddiskX\Partition0 of=lastpart.bin count=976773158 bs=512

File is 70+GB and still running now for 12hours+ from Sata to USB2. Is that normal?

How big is the lastpart.bin?

I feel like I'm doing something wrong?

(i did not do a shield reset before starting this procces and my shield is not bootloader unlocked is this a must?)
[Shield Android TV General] yahoo2016:
If you read the first post, it's "skip=976773158". The file size should be 5120 bytes.

The last part does not change before or after unlock.

I did save the first part before and after unlock. unlock takes 2 hours.
[Shield Android TV General] hallydamaster:
Like yahoo2016 is saying you have to use the skip command instead of count here, because otherwise you just start a cloning procedure of the whole disk.

The bootloader unlock is not a necessity, but if you are migrating to a larger disk you will possible have to do it afterwards. Otherwise you might end up not having all the disk capacity at your disposition.
[Shield Android TV General] Marski1969:
Followed the guide for a Samsung 840 EVo 250Gb.

Just finished so when i come home (working remote) i will switch the drive.

I'm very curious if the Shield is booting first time:p

Will post results later this day.

Many, many, many thanks for all of u that makes this swap possible:good:

update

--------------------------------

Didn't boot at all:crying:

I think making a mistake with dd for windows for my 250Gb 840EVo:

dd if=lastpart.bin of=\\?\Device\HarddiskX\Partition0 bs=512 seek=[B]488397157[/B]

Maybe has to be:

dd if=lastpart.bin of=\\?\Device\HarddiskX\Partition0 bs=512 seek=[B]488397158[/B]

250Gb 840EVo is exact same size as 250Gb 850Evo.
[Shield Android TV General] hallydamaster:
Take the drive out again, put it in a computer and do this in the command prompt:

dd --list

Then supply me with the totalt bytecount of the SSD and I will make a lastpart.bin for you if you want. :)
[Shield Android TV General] Marski1969:
Great, thank U Hallydamaster!:cool:

size is 250059350016 bytes

I really like to see what i did wrong:)

So i do a compare if u send me lastpart.bin

If u ever go to the Netherlands near Delft i will buy u couple of beers!
[Shield Android TV General] hallydamaster:
I'll keep that in mind if I come to Netherlands! ;)

Here is the new lastpart.bin

Flash it like this:

dd if=lastpart250gb.bin of=\\?\Device\HarddiskX\Partition0 bs=512 seek=488397158

And remember to substitute the X with the correct HDD number!

Good luck!
[Shield Android TV General] Marski1969:
U are welcome in Delft hallydamaster!

lastpart250gb.bin is working:)

After that i did all the dd parts over and its working with my own lastpart.bin too.

What i needed to do to get it working is connect the shield en power it up.

Let it run for few min. (i got black screen).

Shut it Off with button (do not cut power from adapter)

Put it On with button and then it is clearing /data cache automatic.

It Reboots automatic and u got a clean Nvidia Shield:cowboy:

Great work hallydamaster, i owe u bigtime!

And indeed its running much faster.

Got a library of ****+ movies in SPMC and it runs like hell now:D
[Shield Android TV General] hallydamaster:
Thanks for the feedback, I'm glad you got it sorted! ;)
[Shield Android TV General] RTNetwork:
Little trouble dumping the SATV partitions

I'm getting an error 5 reading from an Admin command prompt:

\\?\Device\Harddisk4\Partition0
link to \\?\Device\Harddisk4\DR6
Fixed hard disk media. Block size = 512
size is 499405291520 bytes

Virtual input devices
/dev/zero (null data)
/dev/random (pseudo-random data)
- (standard input)

Virtual output devices
- (standard output)

D:\SATVBackup>dd if=\\?\Device\Harddisk4\Partition0 of=firstpart.bin count=6899870
rawwrite dd for windows version 0.5.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by the GPL. See copying.txt for details
Error reading file: 5 Access is denied
0+0 records in
0+0 records out

Any ideas?
[Shield Android TV General] hallydamaster:
Sorry about the late answer.

You must ensure that you really have the admin privileges, because I used that exact command on my setup on a x64 Win10 Pro machine without trouble.

It must be something about access rights, because it apparently refuses to read from the HDD. DD for Windows should be able to read and write from all devices, that the system allows it.
[Shield Android TV General] RTNetwork:
Thanks for the reply. Going to try on my linux machine and see if it works, figure it may be something with rights or locking issue with windows.

Not very clear on how to generate the correct lastbin for my 120GB or 480GB drives?
[Shield Android TV General] hallydamaster:
Definitely easier on a Linux setup, the device names are a little easier to determine.

If you follow my guide from the first post, it will work.

But it's a lot easier if you just use anchung.chen's auto tool from this post:

http://xdaforums.com/showpost.php?p=68209006&postcount=3
[Shield Android TV General] Meastersquallx:
Hello Guys

during dumping the lastpart

the screen showed me an error messege

is it normal? if not, what is the solution for it

Thank you so much

C:\DD>dd if=\\?\Device\Harddisk2\Partition0 of=lastpart.bin skip=976773158 bs=512
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.

skip to 500107856896
Error reading file: 1 Incorrect function
10+0 records in
10+0 records out
[Shield Android TV General] hallydamaster:
Seems kinda weird. Have you examined the output file in a hex editor? If it's all zeros, then you have some trouble reading from the drive.
[Shield Android TV General] Meastersquallx:
First of all thank you hallydamaster for your replay

i did thw whole steps all over again using linux . it went smoothly but when i hooked my SSD which is SanDisk Extreme 240 SDD

the nvidia shield stuck on bootloop

i tried to enter to fastboot for many times but didnt go well

i hope you have solution for my problem

Thank you
[Shield Android TV General] hallydamaster:
Well, it can only mean that an error occurred somewhere when calculating the lastpart.bin

The easiest if you have a Linux distro up and running is to download the auto tool from post #3

That works every time. Otherwise you can supply me with the output from fdisk -l taken from the ssd, then I'll make a lastpart.bin for you.
[Shield Android TV General] grizzlema:
If I plan on replacing the drive with a 500GB Evo drive can i just DD the partitions from the shield drive and write them to the EVO without having to do all the hex editing?
[Shield Android TV General] hallydamaster:
Yes, you should be able to just use dd to clone the drive.

You can't copy by partitions, because you can't read them without breaking the partition layout.

But you can raw write the first and the last part of the drive to a same sized ssd, and it should work.
[Shield Android TV General] grizzlema:
So I'll pretty much lose my data? And start like a factory reset?
[Shield Android TV General] hallydamaster:
Not if you decide to just clone the whole drive. Then it will be like nothing had happened.
[Shield Android TV General] grizzlema:
Sorry for all the questions, but I'm pretty new to all this still. How would I clone the whole drive?
[Shield Android TV General] hallydamaster:
Best setup would be both the SSHD and the new SSD connected to a computer.

Then it's only a matter of copying from a drive to another:

dd if=/dev/sdX of=/dev/sdY bs=1M

I can't recommend it though as that will write to every sector of your new SSD, effectively decreasing its performance.

In my opinion it would be better to set it up the other way like a "factory reset".
[Shield Android TV General] grizzlema:
Thanks for your help, I'll just reinstall my apps and move my hyperspin data back over. Don't want to lose performance since that's the main purpose of doing this.
[Shield Android TV General] grizzlema:
So I started writing my hdd last night and got the firstpart.bin complete, started the lastpart.bin using the code provided in the windows guide

dd if=\\?\Device\Harddisk[B]X[/B]\Partition0 of=lastpart.bin count=976773158 bs=512

it was late so I went to sleep and would pick up tomorrow. Got up this morning and it was still writing. Took a look at the windows command vs the Linux command and noticed there wasn't a skip switch in the windows command. So I'm pretty sure I'm writing the entire drive right now. Correct me if I'm wrong.
[Shield Android TV General] hallydamaster:
I'm so glad you just pointed this out!

I never recieved much feedback on the Windows guide, but you are absolutely right. You have to substitute "count" with "skip".

Writing the lastpart.bin should take a splitsecond, it's only 5120 BYTES!