Hacking Rednand dump sd with dd question

  • Thread starter Thread starter roots
  • Start date Start date
  • Views Views 3,763
  • Replies Replies 7

roots

Well-Known Member
Newcomer
Joined
Nov 9, 2015
Messages
79
Reaction score
33
Trophies
0
Age
41
XP
147
Country
France
hello can someone say to me if a total dump of the sd( after rednand dump) with dd is safe enough or does i have to dump it with sdnandextractor on windows?
i've used dd in=/dev/mmc of=nand.bin
this 64gb file can generate the 3 .bin files like sdnandextractor right?
 
-this 64gb is a complete dump of the device, just make sure you are not only dumping a partition you have to dump the device.
-as it is a complete dump its a save backup
-those 3x .bin files are data somewhere in this 64gb image yes

if you need those 3x .bin files you have to set the proper boundary instead of dumping it completely.

--------------------- MERGED ---------------------------

i am just running a few tests
 
Linux/OSX dumping instructions
No warranty but this should work for 32gb (and if adjusted for 8gb) wiiu and dump slc, slccmt and mlc into the current directory.

You need to know:
- The device name of the SD card in your system
- What kind of WiiU you are using (8GB or 32GB)

What you should do/adjust:
- You need to change the source to your device (not partition 1 on the device)
- If you want to backup the dump from an 8GB wiiu change "MLCSIZE=$MLCSIZE32" to "MLCSIZE=$MLCSIZE8"
- Unmount the first partition of the sdcard (if mounted)
- Add relative or absolute path to destination directory if wanted
- Add shebang if wanted
- Make it executable
- Run the script


The Script:
SOURCE=/dev/disk2
DESTINATION=.
BLOCKSIZE=512

INITIALSKIP=655360
SLCSIZE=536870912
SLCCMPTSIZE=536870912
MLCSIZE32=31784435712
MLCSIZE8=7818182656

MLCSIZE=$MLCSIZE32

#Offset calculation
SLCCOUNT=`expr $SLCSIZE / $BLOCKSIZE`
SLCCMPTCOUNT=`expr $SLCCMPTSIZE / $BLOCKSIZE`
MLCCOUNT=`expr $MLCSIZE / $BLOCKSIZE`

SLCSKIP=`expr $INITIALSKIP / $BLOCKSIZE`
SLCCMPTSKIP=`expr $SLCSKIP + $SLCCOUNT`
MLCSKIP=`expr $SLCCMPTSKIP + $SLCCMPTCOUNT`

#dumping SLC
echo "dumping SLC"
dd bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/slc.full.img count=$SLCCOUNT skip=$SLCSKIP

#dumping SLCCMPT
echo "dumping SLCCMPT"
dd bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/slccmpt.full.img count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP

#dumping MLC
echo "dumping MLC"
dd bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/mlc.full.img count=$MLCCOUNT skip=$MLCSKIP

I've checked that the shasum from both methods are the same!

Btw. it probably makes sense to make the start-stopbits for each image a constant instead of calculating them.
I added blocksize as a variable as it could improve writespeed not using the default.
Might also be usefull to use variables for the output filenames.
 
Last edited by Netfreak25,
I updated the code and made a noob friendlier script out of it

- added a function to prevent overwriting existing files
- added status for dd if available

Usage: ./wiiu_rednand_extractor.sh [TYPE] [MODE] [SOURCE] [DESTINATION]
type 8gb, 32gb
mode all, slc, slccmpt, mlc
source absolute path to source
destination absolute path to destination


All arguments except destination are mandatory
If you don't pass the destination parameter it will use the current directory

E.g.: ./wiiu_rednand_extractor.sh 32gb all /dev/zero /tmp/

# you can edit the default output file names here
SLCIMAGENAME=slc.full.img
SLCCMPTIMAGENAME=slccmpt.full.img
MLCIMAGENAME=mlc.full.img


#DO NOT EDIT BELOW
BLOCKSIZE=512

INITIALSKIP=655360
SLCSIZE=536870912
SLCCMPTSIZE=536870912

MLCSIZE32=31784435712
MLCSIZE8=7818182656

WIIU_TYPE=$1
MODE=$2
SOURCE=$3
DESTINATION=$4

echo "This tool extracts slc, slccmpt and mlc from a device (probably your sd-card)"
echo "It does just dump sectors, it does not even verify the source is a valid rednand"
echo "NO WARRANTY"
echo

function print_help {
echo "Usage: $0 [TYPE] [MODE] [SOURCE] [DESTINATION]"
echo " type 8gb, 32gb"
echo " mode all, slc, slccmpt, mlc"
echo " source absolute path to source"
echo " destination absolute path to destination"
echo
echo "All arguments except destination are mandatory"
echo "If you don't pass the destination parameter it will use the current directory"
echo
echo "E.g.: "$0 32gb all /dev/zero /tmp/
}


# verify input all arguments are available
ERROR=false
if [ ${#WIIU_TYPE} -lt 1 ]
then
echo "Error: No WiiU Type specified"
ERROR=true
else
if [ "$WIIU_TYPE" == "8gb" ]
then
MLCSIZE=$MLCSIZE8
elif [ "$WIIU_TYPE" == "32gb" ]
then
MLCSIZE=$MLCSIZE32
else
echo "Error: $WIIU_TYPE is not a valid WiiU Type"
ERROR=true
fi
fi

if [ ${#MODE} -lt 1 ]
then
echo "Error: No mode specified"
ERROR=true
else
if [ "$MODE" == "slc" ]
then
true
elif [ "$MODE" == "slccmpt" ]
then
true
elif [ "$MODE" == "mlc" ]
then
true
elif [ "$MODE" == "all" ]
then
true
else
echo "Error: $MODE is not a valid Mode"
ERROR=true
fi
fi

if [ ${#SOURCE} -lt 1 ]
then
echo "Error: No source specified"
ERROR=true
fi

if [ $ERROR == "true" ]
then
echo
echo
print_help
exit
else
if [ ${#DESTINATION} -lt 1 ]
then
echo "Error: No destination specified"
echo "Using current directory:"
pwd
echo
DESTINATION=.
fi
fi


function verify_slc {
# verify that nothing gets overwritten
if [ -e $DESTINATION/$SLCIMAGENAME ]
then
echo $DESTINATION/$SLCIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_slccmpt {
if [ -e $DESTINATION/$SLCCMPTIMAGENAME ]
then
echo $DESTINATION/$SLCCMPTIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_mlc {
if [ -e $DESTINATION/$MLCIMAGENAME ]
then
echo $DESTINATION/$MLCIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_all {
verify_slc
verify_slccmpt
verify_mlc
}

#Offset calculation
SLCCOUNT=`expr $SLCSIZE / $BLOCKSIZE`
SLCCMPTCOUNT=`expr $SLCCMPTSIZE / $BLOCKSIZE`
MLCCOUNT=`expr $MLCSIZE / $BLOCKSIZE`

SLCSKIP=`expr $INITIALSKIP / $BLOCKSIZE`
SLCCMPTSKIP=`expr $SLCSKIP + $SLCCOUNT`
MLCSKIP=`expr $SLCCMPTSKIP + $SLCCMPTCOUNT`

#checking if dd is installed
ddstatus=true
which dd > /dev/null 2>&1 || ddstatus=false
if [ $ddstatus == "false" ]
then
echo "dd is not installed"
echo "exiting now"
exit
fi


# check if we can use progress on dd
ddstatus=true
dd status=progress if=/dev/zero of=/dev/null count=1 > /dev/null 2>&1 || ddstatus=false

if [ $ddstatus == "true" ]
then
ddcommand="dd status=progress"
echo "using dd with status as GNU Coreutils is 8.24+ is installed"
else
ddcommand="dd"
echo "using dd without status as GNU Coreutils is 8.24+ is NOT installed"
fi

echo

# start the dump according to mode
function start_dump {
if [ "$MODE" == "all" ]
then
verify_all
echo "The following commands will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_all
elif [ "$MODE" == "slc" ]
then
verify_slc
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_slc
elif [ "$MODE" == "slccmpt" ]
then
verify_slccmpt
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_slccmpt
elif [ "$MODE" == "mlc" ]
then
verify_mlc
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_mlc
fi
}

function dump_slc {
#dumping SLC
echo "Dumping SLC to "$DESTINATION/$SLCIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
echo
}

function dump_slccmpt {
#dumping SLCCMPT
echo "Dumping SLCCMPT to "$DESTINATION/$SLCCMPTIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
echo
}

function dump_mlc {
#dumping MLC
echo "Dumping MLC to "$DESTINATION/$MLCIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
echo
}

function dump_all {
dump_slc
dump_slccmpt
dump_mlc
}

echo "Like I said I can't guarantee that your dump will be functional.."
echo "For me the checksums of the resulting files have been the same like the one from dimoks tool, so i guess it works"
echo "You are doing this on your own risk!"
echo
read -n1 -r -p "Press enter/space to continue..." key
echo

if [ "$key" = '' ]; then
start_dump
else
echo "No enter/space detected"
echo "Exiting now"
exit
fi
 

Attachments

Last edited by Netfreak25,
I updated the code and made a noob friendlier script out of it

- added a function to prevent overwriting existing files
- added status for dd if available

Usage: ./wiiu_rednand_extractor.sh [TYPE] [MODE] [SOURCE] [DESTINATION]
type 8gb, 32gb
mode all, slc, slccmpt, mlc
source absolute path to source
destination absolute path to destination


All arguments except destination are mandatory
If you don't pass the destination parameter it will use the current directory

E.g.: ./wiiu_rednand_extractor.sh 32gb all /dev/zero /tmp/

# you can edit the default output file names here
SLCIMAGENAME=slc.full.img
SLCCMPTIMAGENAME=slccmpt.full.img
MLCIMAGENAME=mlc.full.img


#DO NOT EDIT BELOW
BLOCKSIZE=512

INITIALSKIP=655360
SLCSIZE=536870912
SLCCMPTSIZE=536870912

MLCSIZE32=31784435712
MLCSIZE8=7818182656

WIIU_TYPE=$1
MODE=$2
SOURCE=$3
DESTINATION=$4

echo "This tool extracts slc, slccmpt and mlc from a device (probably your sd-card)"
echo "It does just dump sectors, it does not even verify the source is a valid rednand"
echo "NO WARRANTY"
echo

function print_help {
echo "Usage: $0 [TYPE] [MODE] [SOURCE] [DESTINATION]"
echo " type 8gb, 32gb"
echo " mode all, slc, slccmpt, mlc"
echo " source absolute path to source"
echo " destination absolute path to destination"
echo
echo "All arguments except destination are mandatory"
echo "If you don't pass the destination parameter it will use the current directory"
echo
echo "E.g.: "$0 32gb all /dev/zero /tmp/
}


# verify input all arguments are available
ERROR=false
if [ ${#WIIU_TYPE} -lt 1 ]
then
echo "Error: No WiiU Type specified"
ERROR=true
else
if [ "$WIIU_TYPE" == "8gb" ]
then
MLCSIZE=$MLCSIZE8
elif [ "$WIIU_TYPE" == "32gb" ]
then
MLCSIZE=$MLCSIZE32
else
echo "Error: $WIIU_TYPE is not a valid WiiU Type"
ERROR=true
fi
fi

if [ ${#MODE} -lt 1 ]
then
echo "Error: No mode specified"
ERROR=true
else
if [ "$MODE" == "slc" ]
then
true
elif [ "$MODE" == "slccmpt" ]
then
true
elif [ "$MODE" == "mlc" ]
then
true
elif [ "$MODE" == "all" ]
then
true
else
echo "Error: $MODE is not a valid Mode"
ERROR=true
fi
fi

if [ ${#SOURCE} -lt 1 ]
then
echo "Error: No source specified"
ERROR=true
fi

if [ $ERROR == "true" ]
then
echo
echo
print_help
exit
else
if [ ${#DESTINATION} -lt 1 ]
then
echo "Error: No destination specified"
echo "Using current directory:"
pwd
echo
DESTINATION=.
fi
fi


function verify_slc {
# verify that nothing gets overwritten
if [ -e $DESTINATION/$SLCIMAGENAME ]
then
echo $DESTINATION/$SLCIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_slccmpt {
if [ -e $DESTINATION/$SLCCMPTIMAGENAME ]
then
echo $DESTINATION/$SLCCMPTIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_mlc {
if [ -e $DESTINATION/$MLCIMAGENAME ]
then
echo $DESTINATION/$MLCIMAGENAME already exists
echo no dumps have been created
echo exiting
exit
fi
}

function verify_all {
verify_slc
verify_slccmpt
verify_mlc
}

#Offset calculation
SLCCOUNT=`expr $SLCSIZE / $BLOCKSIZE`
SLCCMPTCOUNT=`expr $SLCCMPTSIZE / $BLOCKSIZE`
MLCCOUNT=`expr $MLCSIZE / $BLOCKSIZE`

SLCSKIP=`expr $INITIALSKIP / $BLOCKSIZE`
SLCCMPTSKIP=`expr $SLCSKIP + $SLCCOUNT`
MLCSKIP=`expr $SLCCMPTSKIP + $SLCCMPTCOUNT`

#checking if dd is installed
ddstatus=true
which dd > /dev/null 2>&1 || ddstatus=false
if [ $ddstatus == "false" ]
then
echo "dd is not installed"
echo "exiting now"
exit
fi


# check if we can use progress on dd
ddstatus=true
dd status=progress if=/dev/zero of=/dev/null count=1 > /dev/null 2>&1 || ddstatus=false

if [ $ddstatus == "true" ]
then
ddcommand="dd status=progress"
echo "using dd with status as GNU Coreutils is 8.24+ is installed"
else
ddcommand="dd"
echo "using dd without status as GNU Coreutils is 8.24+ is NOT installed"
fi

echo

# start the dump according to mode
function start_dump {
if [ "$MODE" == "all" ]
then
verify_all
echo "The following commands will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_all
elif [ "$MODE" == "slc" ]
then
verify_slc
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_slc
elif [ "$MODE" == "slccmpt" ]
then
verify_slccmpt
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_slccmpt
elif [ "$MODE" == "mlc" ]
then
verify_mlc
echo "The following command will be executed:"
echo $ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
read -n1 -r -p "Press any key to start the dumping process..." key
echo
dump_mlc
fi
}

function dump_slc {
#dumping SLC
echo "Dumping SLC to "$DESTINATION/$SLCIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCIMAGENAME count=$SLCCOUNT skip=$SLCSKIP
echo
}

function dump_slccmpt {
#dumping SLCCMPT
echo "Dumping SLCCMPT to "$DESTINATION/$SLCCMPTIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$SLCCMPTIMAGENAME count=$SLCCMPTCOUNT skip=$SLCCMPTSKIP
echo
}

function dump_mlc {
#dumping MLC
echo "Dumping MLC to "$DESTINATION/$MLCIMAGENAME
$ddcommand bs=$BLOCKSIZE if=$SOURCE of=$DESTINATION/$MLCIMAGENAME count=$MLCCOUNT skip=$MLCSKIP
echo
}

function dump_all {
dump_slc
dump_slccmpt
dump_mlc
}

echo "Like I said I can't guarantee that your dump will be functional.."
echo "For me the checksums of the resulting files have been the same like the one from dimoks tool, so i guess it works"
echo "You are doing this on your own risk!"
echo
read -n1 -r -p "Press enter/space to continue..." key
echo

if [ "$key" = '' ]; then
start_dump
else
echo "No enter/space detected"
echo "Exiting now"
exit
fi
(Sorry for bump)
Okay, I actually simply didn't read the example. Fail. But, how do I restore a RedNand backup?
 
Last edited by SirNapkin1334,

Site & Scene News

Popular threads in this forum