Te kape i nga pukapuka ki nga punaha rokiroki ma te punaha Linux ma te whakamahi i te XCOPY

Ko te mea ka hiahia koe ki te tiki i te kape katoa o te rōrahi i roto i te punaha rokiroki raraunga kotahi (DSS), ehara i te hopu whakaahua, i te kiore, engari he rōrahi tonu. Engari kaore te punaha rokiroki e tuku i nga wa katoa kia mahia a roto ma te whakamahi i ana ake tikanga. Ko te ahua ko te mea anake ko te kape ma te tūmau, engari i tenei keehi ka peia te katoa o nga raraunga i roto i te tūmau ake, te whatunga ki te punaha rokiroki me nga tauranga rokiroki, ka utaina enei waahanga katoa. Engari he whakahau SCSI ka taea e koe te mahi i nga mea katoa i roto i te punaha rokiroki ake, a mena kei te tautoko to punaha i te VAAI mai i VMware, ka tata ki te 100% kei te tautokohia te whakahau XCOPY (EXTENDED COPY), e whakaatu ana ki te rarangi he aha me ki hea ki te kape, me te kore e uru ki te tūmau tukanga me te whatunga.

Te ahua nei me ngawari nga mea katoa, engari kaore au i kite i nga tuhinga kua rite tonu, no reira me hanga ano e au te wira. I tohua a Linux mo te OS tūmau, a ko te whakahau ddpt (http://sg.danny.cz/sg/ddpt.html) i tohua hei taputapu kape. Ma te whakamahi i tenei huinga, ka taea e koe te kape i nga pukapuka mai i tetahi OS, na te mea ka puta te kape i te poraka i te poraka i te taha o te punaha rokiroki. I te mea e tika ana ki te kape i te poraka ma te poraka, me te tatau i te maha o nga poraka, i whakamahia te tono blockdev ki te tatau i te maha o aua whitiwhitinga. Ko te rahi o te paraka i whiwhi i nga whakamatautau; kaore i tino mahi te ddpt ki tetahi poraka nui. Ko te hua ko te tuhinga tino ngawari e whai ake nei:

#!/bin/bash
# first parameter = input device
# second parameter = output device
# device size must be the same
# changing bs variable can reduce speed, max speed should be at bs=32768. 32768 is max setting, lower settings should be calculated dividing by 2

set -o nounset
bs=32768
s=`blockdev --getsz $1`
i=0
while [ $i -le $s ]
do
ddpt of=$2 bs=512 oflag=xcopy,direct if=$1 iflag=xcopy,direct count=$bs verbose=-1 skip=$i seek=$i
i=$(( $i+$bs ))
done

Me mahi he tirotiro iti! Ana, he mea iti, he konae 1TB kaore i tere te hanga me te tirotirohia e md5sum :)

root@sales-demo-05:/home/vasilyk# blockdev --getsz /dev/mapper/mpathfs
2516582400
root@sales-demo-05:/home/vasilyk# blockdev --getsz /dev/mapper/mpathfr
2516582400
root@sales-demo-05:/home/vasilyk# mount /dev/mapper/mpathfs /xcopy_source/
mount: /xcopy_source: wrong fs type, bad option, bad superblock on /dev/mapper/mpathfs, missing codepage or helper program, or other error.
root@sales-demo-05:/home/vasilyk# mkfs /dev/mapper/mpathfs
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done
Creating filesystem with 314572800 4k blocks and 78643200 inodes
Filesystem UUID: bed3ea00-c181-4b4e-b52e-d9bb498be756
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

root@sales-demo-05:/home/vasilyk# mount /dev/mapper/mpathfs /xcopy_source/
root@sales-demo-05:/home/vasilyk# ls -l /xcopy_source/
total 16
drwx------ 2 root root 16384 Aug 19 15:35 lost+found
root@sales-demo-05:/home/vasilyk# head -c 1T </dev/urandom > /xcopy_source/1TB_file
root@sales-demo-05:/home/vasilyk# ls -l /xcopy_source/
total 1074791444
-rw-r--r-- 1 root root 1099511627776 Aug 19 17:25 1TB_file
drwx------ 2 root root         16384 Aug 19 15:35 lost+found
root@sales-demo-05:/home/vasilyk# umount /xcopy_source
root@sales-demo-05:/home/vasilyk# mount /dev/mapper/mpathfr /xcopy_dest/
mount: /xcopy_dest: wrong fs type, bad option, bad superblock on /dev/mapper/mpathfr, missing codepage or helper program, or other error.
root@sales-demo-05:/home/vasilyk# cat xcopy.sh
#!/bin/bash
# first parameter = input device
# second parameter = output device
# device size must be the same
# changing bs variable can reduce speed, max speed should be at bs=32768. 32768 is max setting, lower settings should be calculated dividing by 2

bs=32768
s=`blockdev --getsz $1`
i=0
while [ $i -le $s ]
do
ddpt of=$2 bs=512 oflag=xcopy,direct if=$1 iflag=xcopy,direct count=$bs verbose=-1 skip=$i seek=$i
i=$(( $i+$bs ))
done
root@sales-demo-05:/home/vasilyk# time ./xcopy.sh /dev/mapper/mpathfs /dev/mapper/mpathfr
real    11m30.878s
user    2m3.000s
sys     1m11.657s

He aha te mahi i runga i te punaha rokiroki i taua wa:

Te kape i nga pukapuka ki nga punaha rokiroki ma te punaha Linux ma te whakamahi i te XCOPY
Kia haere tonu me Linux.

root@sales-demo-05:/home/vasilyk# mount /dev/mapper/mpathfr /xcopy_dest/
root@sales-demo-05:/home/vasilyk# ls -l /xcopy_dest/
total 1074791444
-rw-r--r-- 1 root root 1099511627776 Aug 19 17:25 1TB_file
drwx------ 2 root root         16384 Aug 19 15:35 lost+found
root@sales-demo-05:/home/vasilyk# mount /dev/mapper/mpathfs /xcopy_source/
root@sales-demo-05:/home/vasilyk# md5sum /xcopy_source/1TB_file
53dc6dfdfc89f099c0d5177c652b5764  /xcopy_source/1TB_file
root@sales-demo-05:/home/vasilyk# md5sum /xcopy_dest/1TB_file
53dc6dfdfc89f099c0d5177c652b5764  /xcopy_dest/1TB_file
root@sales-demo-05:/home/vasilyk#

I pai nga mea katoa, engari whakamatautau me te whakamahi i to tupono! Ka rite ki te rōrahi puna, he pai ake te tango whakaahua, hei tiimatanga.

Source: will.com

Tāpiri i te kōrero