I
Size: a a a
I
F
S
V
n
dd if=/dev/zero of=bigfile.dat bs=1022 count=22
#!/bin/bash
set -e
if [ $# -ne 1 ];then
echo "Usage: $@ filepath"
exit 1
fi
giga=$((1024*1024*1024))
filesize=$(stat --printf="%s" $1)
N=$(($filesize / $giga))
offset=0
mkdir -p chunks
for (( i=0; i<$N+1; i++ ));do
dd if=$1 \
of="chunks/$i.bin" \
bs=512 \
count=$((giga/512)) \
skip=$offset 2>/dev/null
echo "[+] Chunk $i/$N"
offset=$((offset+$giga/512))
done
#
ls chunks/
0.bin 12.bin 15.bin 18.bin 20.bin 3.bin 6.bin 9.bin
10.bin 13.bin 16.bin 19.bin 21.bin 4.bin 7.bin
11.bin 14.bin 17.bin 1.bin 2.bin 5.bin 8.bin
#!/bin/bash
set -e
if [ $# -ne 1 ];then
echo "Usage: $@ <dirpath to chunks/>"
exit 1
fi
for chunk in $(ls $1 | sort -h);do
fp=$1/$chunk
echo "[+] Assembling: $fp.."
chunksize=$(stat --printf="%s" $fp)
dd if=$fp of=bigfile-assembled.bin bs=$chunksize oflag=append conv=notrunc 2>/dev/null
done
md5sum bigfile*
fac6df9ad55d8bc7c4c0094c500d3a8c bigfile-assembled.bin
fac6df9ad55d8bc7c4c0094c500d3a8c bigfile.dat
YG
YG
YG
~
Vs
S
Vs
Vs
Vs
Vs
S
S
Vs