xboxscene.org forums

OG Xbox Forums => Hardware Forums => General Hardware/Technical Chat => Topic started by: ldotsfan on September 03, 2012, 07:42:00 AM

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 03, 2012, 07:42:00 AM
QUOTE

those in the list using the flag -dusbjmicron for smartmontools.

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 06, 2012, 07:40:00 AM
QUOTE(ldotsfan @ Sep 3 2012, 09:42 PM) View Post

Only JMicron chipset is supported. Is Oxford chip mentioned? You did see this part of the post right

Turned out I'm wrong  tongue.gif I just locked a Western Digital Elements external hdd over usb with hdparm and this is straight from the smartmontools list under -dsat which means SCSI-ATA Translation. In a nutshell the list of supported chipsets now expands to all those listed under -dsat. The odds of the Oxford chip working increases accordingly.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: aliaric on September 08, 2012, 09:26:00 AM
I have demounted Seagate Free Agent Go board. I try to test it with your solution.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 09, 2012, 06:35:00 AM
I noticed the latest version of smartmontools had security freeze lock capability so I extended it to do the rest of the security feature set:

CODE

smartmontools-5.43 # ./smartctl --get=security /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security is:  Disabled, NOT FROZEN [SEC1]
smartmontools-5.43 # ./smartctl --set=security-setpass,XBOXSCENE /dev/sdc
PASSWORD XBOXSCENE
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security setpass
smartmontools-5.43 # ./smartctl --get=security /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security is:  ENABLED, PW level MAX, not locked, not frozen [SEC5]
smartmontools-5.43 # ./smartctl --set=security-disable,XBOXSCENE /dev/sdc
PASSWORD XBOXSCENE
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security disabled
smartmontools-5.43 # ./smartctl --get=security /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security is:  Disabled, NOT FROZEN [SEC1]


What this means is that all usb chipsets supported by smartmontools: sat, cypress, sunplus, jmicron are now available. It is also supported on various OS/platforms:

QUOTE

It should run on any modern Darwin (Mac OS X), Linux, FreeBSD, NetBSD, OpenBSD, Solaris, OS/2, Cygwin, QNX, eComStation or Windows system.

Windows and OS X are especially interesting. I will try to patch eeprom support before releasing the changes. I will try to release a Windows executable at a later stage.

This post has been edited by ldotsfan: Sep 9 2012, 01:37 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: shambles1980 on September 09, 2012, 09:49:00 AM
keep up the good work smile.gif
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 11, 2012, 09:11:00 AM
Windows 64-bit version with eeprom support.

CODE

D:\>smartctl.exe --set=security-eeprom-setpass,eeprom.bin /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-w64-mingw32-win7-sp1] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security setpass

D:\>smartctl.exe --get=security /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-w64-mingw32-win7-sp1] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security is:  ENABLED, PW level MAX, not locked, not frozen [SEC5]

D:\>smartctl.exe --set=security-eeprom-disable,eeprom.bin /dev/sdc
smartctl 5.43 2012-06-30 r3573 [x86_64-w64-mingw32-win7-sp1] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

ATA Security disable


I'll be creating the 32bit version as well.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 12, 2012, 09:12:00 AM
1. Windows 32bit version with eeprom support compiled.
2. Linux version with eeprom support compiled.

An empty 8Gb stock FATX image compressed with 7zip is only 1.2MB. Combined with a disk cloning program of your choice(Acronis or HDD Raw Copy Tool etc)  this opens up the possibility of formatting a xbox hdd entirely from Windows - provided you have a compatible USB/ATA adapter but now the list of supported models is much larger. You'll still need xplorer360 to copy files over though.

This post has been edited by ldotsfan: Sep 12 2012, 04:13 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 13, 2012, 07:42:00 AM
Uploaded Windows version of files to here.

You'll need a compatible usb/ata adapter, see list at smartmontools
Basic instructions:
1. Unzip files with 7-zip to a given folder, for example hdd folder. Copy eeprom.bin to this folder.
2. Restore 8gb.bin (empty 8GB FATX hdd image created by xboxdumper) to target hdd connected via usb adapter. Use raw mode or bit-level restore. Example of such a tool: HDD Raw Copy Tool. EDIT: Alternative method in the next post.
3. Copy desired files to target hdd with xplorer360.
4. Lock target hdd with these instructions by running the command below in Command Prompt with Administrative Rights. You can do a search for Command Prompt in Windows and right-click on the item for the "Run As Administrator" option.
a.
CODE

smartctl -i /dev/sdX

where sdX is target hdd. Make sure the output matches your expectations of the target hdd in terms of size and model.
Possible values of sdX: sda, sdb, sdc and so on. If you are using Windows 32 bit, use smartctl-w32 instead.
b. Then lock once identity is confirmed
CODE

smartctl --set=security-eeprom-setpass,eeprom.bin /dev/sdX

where sdX could be sda or sdb and so on, matching the value in part a.
c. Confirm hdd is locked
CODE

smartctl --get=security /dev/sdX

where sdX could be sda or sdb and so on, matching the value in part a.

This post has been edited by ldotsfan: Sep 17 2012, 02:01 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on September 17, 2012, 07:11:00 AM
Alternative method of creating a xbox hdd:

Option:
1. Shell Script: See this thread
2. Create.c. A Linux/Windows program that does the same thing. But you'll need smartctl to identify the right hdd on Windows:
CODE

smartctl -i /dev/pd#

where # is 0,1,2,3 and so on. Identifying the target hdd to be partitioned/formatted with FATX.
CODE

create #

# has to be the same number used in smartctl.

This post has been edited by ldotsfan: Sep 17 2012, 03:20 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on October 06, 2012, 12:50:00 AM
The versions uploaded were buggy when tested with a locked hdd from a xbox. I've cross-checked against the code from xbox linux and corrected the bug.

I will upload Windows and Linux versions once I've rebuilt them. Uploaded version 1.1 to here.

This post has been edited by ldotsfan: Oct 6 2012, 04:59 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on October 22, 2012, 08:17:00 AM
smartmontools version 6.0 was released on Oct 10. I have patched the security and eeprom features to this version as well and will update the executables for Windows and Linux.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on October 31, 2013, 06:25:00 AM
Version bump to 6.2 to be in sync with smartmontools. Grab files from here
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: kezrwaw on November 02, 2013, 12:30:00 PM
and disable option is not working
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: Riggity Ryan on August 10, 2015, 04:42:00 PM

Pretty sad... it's 2015 and I go ahead and resurrect this topic.  Haha.

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: T2Steve on August 11, 2015, 01:27:00 AM

what kind of hard drive are you using? I'd be inclined to use xboxhdm to manually lock it. Does your box have a chip in it?

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 15, 2011, 09:26:00 AM
For a long time, I believed it was impossible to lock and unlock the xbox hdd with a USB-(S)ATA adapter. But apparently somebody has done it with JMicron chipset and it is also supported in Cypress chipset.  

p-eak's comment on honzaf's patch to hdparm revealed he did a security erase which is indicative of use of the ATA security features. I did some work on incorporating hdparm stuff into hdtool - I am hoping I can recall enough of that stuff and use honzaf's patch in hdtool.

This requires further investigation. It will open up another avenue of doing hdd upgrades if successful as hdtool is the key component in xboxhdm2.X hdd lock/unlocking.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: spliff721 on April 15, 2011, 10:08:00 AM
Appreciate your efforts. Let me know if you need any help testing.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 15, 2011, 10:21:00 PM
I just locked a sata hdd over JMicron usb/sata adapter with a patched hdparm 9.35.

CODE

# ./hdparm --security-set-pass password /dev/sdc
# ./hdparm -I /dev/sdc

/dev/sdc:

ATA device, with non-removable media
    Model Number:       Hitachi XXXXXXXXXXXXXXXXXX                
    Serial Number:      XXXXXXXXXXXXXXXXX
    Firmware Revision:  V54OA7EA
Standards:
    Used: ATA/ATAPI-7 T13 1532D revision 1
    Supported: 7 6 5 4 & some of 8
Configuration:
    Logical        max    current
    cylinders    16383    16383
    heads        16    16
    sectors/track    63    63
    --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  268435455
    LBA48  user addressable sectors:  625142448
    Logical/Physical Sector size:           512 bytes
    device size with M = 1024*1024:      305245 MBytes
    device size with M = 1000*1000:      320072 MBytes (320 GB)
    cache/buffer size  = 15315 KBytes (type=DualPortCache)
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16    Current = 0
    Advanced power management level: disabled
    Recommended acoustic management value: 128, current value: 128
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 *udma4 udma5 udma6
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled    Supported:
            SMART feature set
       *    Security Mode feature set
       *    Power Management feature set
       *    Write cache
       *    Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    DOWNLOAD_MICROCODE
            Advanced Power Management feature set
            Power-Up In Standby feature set
            SET_FEATURES required to spinup after power up
            Address Offset Reserved Area Boot
            SET_MAX security extension
       *    Automatic Acoustic Management feature set
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
            Media Card Pass-Through
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
       *    URG for READ_STREAM[_DMA]_EXT
       *    URG for WRITE_STREAM[_DMA]_EXT
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Host-initiated interface power management
       *    Phy event counters
            Non-Zero buffer offsets in DMA Setup FIS
            DMA Setup Auto-Activate optimization
            Device-initiated interface power management
            In-order data delivery
       *    Software settings preservation
       *    SMART Command Transport (SCT) feature set
       *    SCT Long Sector Access (AC1)
       *    SCT LBA Segment Access (AC2)
       *    SCT Error Recovery Control (AC3)
       *    SCT Features Control (AC4)
       *    SCT Data Tables (AC5)
Security:
    Master password revision code = 65534
        supported
        enabled
        locked
    not    frozen
    not    expired: security count
    not    supported: enhanced erase
    Security level high
    128min for SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: XXXXXXXXXXXXXXXXX
    NAA        : 5
    IEEE OUI    : 000cca
    Unique ID    : XXXXXXXXXX
Integrity word not set (found 0x0000, expected 0xf9a5)


The next step is to see if this locking logic can go inside hdtool.

QUOTE(spliff721 @ Apr 16 2011, 12:08 AM) View Post

Appreciate your efforts. Let me know if you need any help testing.

Thanks. As I have a JMicron adapter, I'll be able to test. Are you familiar with Linux?
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 16, 2011, 12:52:00 AM
I uploaded the patched version of hdparm to here.

An interim measure for using hex passwords with hdparm:
CODE

./hdparm --security-set-pass `echo -e "\xA\xB"` /dev/sdX


Where A is the hex value of password, B is second hex value and so on. X will be device location of hdd.

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: obcd on April 16, 2011, 02:26:00 AM
Good to hear there finally is a way.

Do you think it would be possible to use the alternative method for unlocking
(reading the system area of the disk) as well?

I am suprised no one already cleaned up that stuff yet with the proper area for the xbox 8Gig and 10Gig stock harddisks.

It would mean you could take the harddisk out of the xbox and connect it to the usb adapter.
You could then unlock it, mod it and lock it again. No more dangerous and unreliable hotswap.

As Hannibal Smith (A team) would say: "I love it when a plan comes together."

regards.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 16, 2011, 03:32:00 AM
QUOTE(obcd @ Apr 16 2011, 04:26 PM) View Post

Good to hear there finally is a way.

For some strange reason, I wasn't able to get hdtool to work. Instead I patched hdtool's eeprom functions into hdparm instead  tongue.gif
Here's the patched hdparm. This worked under Ubuntu Maverick for me.

QUOTE(obcd @ Apr 16 2011, 04:26 PM) View Post

Do you think it would be possible to use the alternative method for unlocking
(reading the system area of the disk) as well?

I am suprised no one already cleaned up that stuff yet with the proper area for the xbox 8Gig and 10Gig stock harddisks.

It would mean you could take the harddisk out of the xbox and connect it to the usb adapter.
You could then unlock it, mod it and lock it again. No more dangerous and unreliable hotswap.

That's beyond my capability at the moment. Somebody else could try it   jester.gif
I am only aware of the MHDD 4.5 method for WDC hdd - is there a publicly known method for Seagate hdd? And I barely understand the method - let along code it in Linux.  tongue.gif But I will give it some thought in the future.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: obcd on April 16, 2011, 05:03:00 AM
It was my understanding that every harddisk has a system area.
It's a zone of the disk that is no part of the normal disk area used to store data.
The ata command set also has commands to read and modify data in that zone.
Most harddisks seem to have the locking password somewhere in that zone as well.
So basically, you could lock a disk with a known password, and read that zone. Afterwards, you can change the password and read that zone again. By comparing the 2 reads, you might be able to find the location of the hdd password. (I bet it will be encrypted.) If you would change that area to a known password, you could unlock the harddisk afterwards, since you know the password.

This is all very nice in theory, but it is very well possible that the password isn't saved as a continue chain of bytes to improve protection. There probably is a byte to enable / disable password protection as well, but that will be hard to find as well. If you mess with the wrong bytes in that zone, you will probably brick your harddisk with no way of recovery.

It looked like an interesting way of doing things, specially if you know that there are only 2 models of stock harddisks in the xbox 1.

I downloaded the links to give it a try some day, but time is working against me.  (IMG:style_emoticons/default/mad.gif)

regards.

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 17, 2011, 01:42:00 AM
QUOTE(ldotsfan @ Apr 16 2011, 05:32 PM) View Post

Here's the patched hdparm. This worked under Ubuntu Maverick for me.

The earlier version will boot to error 6 in xbox. This version corrects that and does a swapping of bytes for the model and serial no.

Some basic documentation:
CODE

./hdparm --security-help

ATA Security Commands:
 Most of these are VERY DANGEROUS and can destroy all of your data!
 Due to bugs in older Linux kernels, use of these commands may even
 trigger kernel segfaults or worse.  EXPERIMENT AT YOUR OWN RISK!

 --security-freeze           Freeze security settings until reset.

 --security-set-pass PASSWD  Lock drive, using password PASSWD:
                                  Use 'NULL' to set empty password.
                                  Drive gets locked if user-passwd is selected.
 --security-unlock   PASSWD  Unlock drive.
 --security-disable  PASSWD  Disable drive locking.
 --security-eeprom-lock eepromfilename  Lock drive, using password generated from eeprom file:
                                  Use 'NULL' to set empty password.
                                  Drive gets locked if user-passwd is selected.
 --security-eeprom-unlock   eepromfile  Unlock drive.
 --security-eeprom-disable  eepromfile  Disable drive locking.
 --security-erase    PASSWD  Erase a (locked) drive.
 --security-erase-enhanced PASSWD   Enhanced-erase a (locked) drive.

 The above four commands may optionally be preceeded by these options:
 --security-mode  LEVEL      Use LEVEL to select security level:
                                  h   high security (default).
                                  m   maximum security.
 --user-master    WHICH      Use WHICH to choose password type:
                                  u   user-password (default).
                                  m   master-password


1. To lock, issue security-eeprom-lock.
2. To unlock,issue security-eeprom-unlock followed by security-eeprom-disable.
3.  hdparm -I to check status. hdparm -i doesn't work for usb/(s)ata adapter.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 18, 2011, 07:33:00 AM
A little howto on how to use this with Ubuntu to prepare a new xbox hdd or alternatively an upgraded hdd.

Tools needed:
1. Ubuntu installed to pc hdd. Ubuntu Maverick is the tested version.
2. xboxhdm2.3 pack. This packaged the xboxhdm 1.9 kernel, initrd, hdparm executable and the empty C and E folders in a particular folder structure along with fatx folder which xboxhdm1.9 expects. Grab the file from here.
3. qemu. We will install via Ubuntu Software Center or apt command later.
4. eeprom.bin. Place this file in the same folder as the hdm2.3 pack.
5. JMicron based usb/(s)ata adapter. Any of these models should work:
a.JMicron JM20329 (USB->SATA)
b.JMicron JM20336 (USB+SATA->SATA, USB->2xSATA)
c.JMicron JM20337/8 (USB->SATA+PATA, USB+SATA->PATA)
d. JMicron JM20339 (USB->SATA)
Cypress may work as well since Ubuntu Maverick uses the cypress_atacb kernel module. But it is untested.

Steps:
1. Install qemu. Do this from Ubuntu Software Center or use this command
CODE

sudo su
apt-get install qemu

2. Unpack the xboxhdm2.3 pack into a folder. eeprom.bin to be copied here too.
3. Copy C files into hdm/C folder. Select all files/folder in C folder , right click and compress to tar.gz format. We do this step to avoid truncation of filenames later when qemu uses virtual fat to mount the hdm folder. Let's rename/call the file c.tgz
4. Start a terminal at the folder.
5. Type this command to invoke qemu to run xboxhdm1.9 under Ubuntu.
CODE

sudo su
qemu -kernel hdmboot/fatxImage -initrd hdmboot/initrd.gz -append 'load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=24000 rw root=/dev/ram pci=biosirq' -hda /dev/sdc -hdc fat:hdm/

You need to ensure that xbox hdd is really at sdc. Double check before executing this line. We ask qemu to use virtual fat to see the hdm folder as hdc. You can check with the output from
CODE

./hdparm -I /dev/sdc

Otherwise amend sdc accordingly to sdb or sdd and so on.
6. Once xboxhdm1.9 boots, type this command at the prompt.
CODE

mount -o bind /xbox /xboxhdm

This is to allow xboxhd script to see the contents of hdc as a cdrom drive.
7. Run xboxhd. You use steps 1 to 5 to prepare the hdd.
CODE

xboxhd

8. Quit from xboxhd, and run xbrowser
CODE
xbrowser

9. Navigate to PriMas/C folder. Type this command.
CODE

tar zxf c.tgz

This extract the contents of C folder which we compressed in step 3
10.Exit from xbrowser.
11. Type
CODE

poweroff
to exit from qemu.
12. Back in ubuntu terminal, type this command to lock the hdd.
CODE

chmod a+x hdparm
./hdparm --security-eeprom-lock eeprom.bin /dev/sdc

13. Check that hdd is locked
CODE

./hdparm -I /dev/sdc


EDIT:
1. Testing by xboxmods2977 confirmed that Ubuntu installed to hdd is required and execute permission to be granted to hdparm executable.

This post has been edited by ldotsfan: May 15 2011, 11:23 AM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on April 18, 2011, 12:45:00 PM
QUOTE(ldotsfan @ Apr 18 2011, 03:33 PM) View Post

sudo su
qemu -kernel hdmboot/fatxImage -initrd hdmboot/initrd.gz -append 'load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=24000 rw root=/dev/ram pci=biosirq' -hda /dev/sdc -hdc fat:hdm/

I'm getting a framebuffer error:
(!) DirectFB/FBDev Error opening framebuffer device!
(!) DirectFB/FBDev Use 'fbdev' option or set FRAMEBUFFER environment variable.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on April 18, 2011, 04:02:00 PM
Nevermind. I got it to start. Intrepid Ibex (backtrack 4).

hdparm is killed as a buffer overflow tho when I try to run it. I guess I will try it in a live cd environment of 10.10  smile.gif
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 21, 2011, 09:01:00 AM
QUOTE(xboxmods2977 @ Apr 19 2011, 06:02 AM) View Post

Nevermind. I got it to start. Intrepid Ibex (backtrack 4).

hdparm is killed as a buffer overflow tho when I try to run it. I guess I will try it in a live cd environment of 10.10  smile.gif

Looking forward to hearing from you.

QUOTE(ldotsfan @ Apr 18 2011, 09:33 PM) View Post

5. JMicron based usb/(s)ata adapter. Any of these models should work:
a.JMicron JM20329 (USB->SATA)
b.JMicron JM20336 (USB+SATA->SATA, USB->2xSATA)
c.JMicron JM20337/8 (USB->SATA+PATA, USB+SATA->PATA)
d. JMicron JM20339 (USB->SATA)
Cypress may work as well since Ubuntu Maverick uses the cypress_atacb kernel module. But it is untested.

This is optional. If somebody just want to use a lean version of xboxhdm2.X usb without the SLAX dependency from their favorite linux distro and connect the hdd to the motherboard IDE connection, the addon with hdparm included and qemu is good to go too.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on April 28, 2011, 08:09:00 AM
QUOTE(obcd @ Apr 16 2011, 07:03 PM) View Post

It looked like an interesting way of doing things, specially if you know that there are only 2 models of stock harddisks in the xbox 1.


I'm starting to understand this.

From hdparm's sgio.h:
CODE

struct taskfile_regs {
    __u8    data;
    __u8    feat; //0x57
    __u8    nsect; //0x44
    __u8    lbal; //0x43
    __u8    lbam; // 0x00
    __u8    lbah; // 0x00
    __u8    dev; // 0xa0
    __u8    command; //0x8a
};

This will activate the vendor command "WDC_SUPER_ON" for WDC hdd. I have a locked WDC stock hdd without the eeprom contents to experiment on.

I hope to report some progress soon.

Alternative I will use the SCT command instead if that doesn't work.
CODE

0x45 0x0b 0x00 0x44 0x57 0xa0 0x80


Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on April 28, 2011, 06:40:00 PM
Got it working good in a live CD environment of 10.10. As far as hdparm, when I run this:

./hdparm --security-eeprom-lock eeprom.bin /dev/sdc

It lists hdparm usage

When I run this:

./hdparm -I /dev/sdc

I get "HDIO_DRIVE_CMD(identify) failed: Invalid exchange"

This is using an IDE xbox HD with the JMicron JM20337/8 (USB->SATA+PATA, USB+SATA->PATA) adapter.

I'm gonna try some more experimenting on a computer tho now.

This post has been edited by xboxmods2977: Apr 29 2011, 02:18 AM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on May 12, 2011, 08:45:00 AM
QUOTE(xboxmods2977 @ Apr 29 2011, 08:40 AM) View Post

I get "HDIO_DRIVE_CMD(identify) failed: Invalid exchange"

This is using an IDE xbox HD with the JMicron JM20337/8 (USB->SATA+PATA, USB+SATA->PATA) adapter.

I'm gonna try some more experimenting on a computer tho now.

A quick Google seems to suggest kernel config problem, seems like live version of 10.10 and hdd install of 10.10 use different kernel .config?

This is the lsusb output for my adapter:
CODE

Bus 001 Device 005: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge


Is yours the same?
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on May 12, 2011, 12:24:00 PM
It appears to be the same
CODE
ubuntu@ubuntu:~$ lsusb
Bus 001 Device 002: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge

My device number is the only thing that varies.

This post has been edited by xboxmods2977: May 12 2011, 07:25 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on May 13, 2011, 08:08:00 AM
OK. update:
I bit the bullet and set up ubuntu 10.10 on my laptop dual-booting it, and backtrack 4, just to test this stuff further and even with a clean install of ubuntu maverick, I get the same error as before.

So I guess maybe this doesn't work for IDE HD's? or I am missing something. Prerequisites? Kernel modules?

Just to confirm, I used the guide you posted in this thread but since I already had a fully working xbox HD, I skipped right to steps 12 and 13. Is this ok? I get the errors noted above when I try those 2 commands.

Something else I noticed. I can't copy and paste the commands directly or I get "permission denied", even after cd'ing to the hdm2.3 dir and sudo su'ing. I have to type them this way:
CODE
hdparm --security-eeprom-lock eeprom.bin /dev/sdb (sdb is my drive)


note that I had to leave out the "./" at the beginning.

This post has been edited by xboxmods2977: May 13 2011, 03:17 PM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on May 13, 2011, 09:59:00 PM
My kernel details from uname: 2.6.35-28-generic-pae

The IDE hdd should work as well. While testing, I unlocked an IDE hdd with the same adapter.

Without the ./ in the command, it may be running the resident copy of hdparm in Maverick rather than the copy in the dir. Unless your shell env already has . in its $PATH

Can you try granting permission with chmod a+x hdparm in the hdm2.3 dir and run with the ./ prefix?
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: xboxmods2977 on May 14, 2011, 07:32:00 PM
Yep. Worked like a charm. So now, I am gonna go back to the live CD environment and see if maybe the whole reason it didn't work before was because I hadn't given the new hdparm execute permissions.  Thanks man. You're the shit! Keep up the good work!

EDIT: Nope. No live environments. Install only.

This post has been edited by xboxmods2977: May 15 2011, 03:02 AM
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on May 15, 2011, 04:21:00 AM
Great! Thanks to your testing, now we know this really works and the requirements for using it, an installed Ubuntu and the JMicron based adapter.

I'll update the earlier post with the chmod instruction to make things clearer.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on May 16, 2011, 10:33:00 PM
This works under virtualization as well.

I executed Ubuntu Natty installed to hdd as guest OS in Virtualbox under Windows 7 host OS and was able to lock and unlock a stock seagate hdd with hdparm.

Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on May 18, 2011, 06:48:00 AM
Smartmontools has better support for USB than hdparm.

Nevertheless hdparm should have SAT ATA pass-through as well as JMicron but lacking in Sunplus and Cypress.

I'll be interested to hear from testers with access to USB adapters using ASMedia, Initio, Oxford and other such chipsets.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: sfgsgvs on August 27, 2011, 04:34:00 PM
QUOTE(ldotsfan @ May 17 2011, 06:33 AM) *

This works under virtualization as well.

I executed Ubuntu Natty installed to hdd as guest OS in Virtualbox under Windows 7 host OS and was able to lock and unlock a stock seagate hdd with hdparm.


Could you please upload a Virtualbox hard drive image like the one you used? It would be of great help for us that don't know how to install and setup Linux, and a big timesaver aswell if we all could use the same setup. Building drives works great using xboxhdm 1.9 in Virtual PC, I only need to be able to lock/unlock drives. It's kind of a hassle to dig out an old computer every time just for the locking/unlocking part (IMG:style_emoticons/default/wink.gif)
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: sfgsgvs on August 29, 2011, 01:36:00 PM
I think I got it setup the right way now through VirtualBox, but I can't lock or unlock the drives. If I try to lock/unlock a Seagate HDD from an old Xbox I get this error message:

CODE
The running kernel lacks CONFIG_IDE_TASK_IOCTL support for this device.
SECURITY_UNLOCK: Invalid argument


Does this mean my USB -> IDE/SATA-adapter isn't compatible, or is something else giving me this error? The chipset in my adapter is Genesys Logic GL830. ./hdparm -I /dev/sdb is working though and gives me the right model, serial number, firmware revision etc. ./hdparm -I /dev/sdb didn't work with another external USB HDD I tried, so I'm hoping something else (preferably something easy to fix) is wrong with my setup.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on March 16, 2012, 06:40:00 PM
QUOTE(sfgsgvs @ Aug 28 2011, 06:34 AM) View Post

Could you please upload a Virtualbox hard drive image like the one you used?

Virtualbox images are available here: http://virtualboxes.org/images/ubuntu/
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on August 25, 2012, 11:06:00 PM
Mark K ( donut123 ) posted a patch against hdparm for non-ascii passwords in a file. I'll have a go at code merging the patch into the jmicron branch of hdparm since it's a logical fit. donut123's other comments for hdparm are equally interesting from xbox1 hdd security's perpective.
Title: Locking Hdd With Usb-(s)ata Adapter.
Post by: ldotsfan on August 25, 2012, 11:31:00 PM
A list of devices with a good chance of being supported: those in the list using the flag -dusbjmicron for smartmontools. hdparm's jmicron support is based on similar code.