間違いだらけの備忘録

このページの内容は無保証でありこのページの内容によって直接、または間接に損害を受けられたとしても私は責任を取りません。

HDD backup前の確認

dd_rescue(ddrescue)版

root@ubuntu:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.10
DISTRIB_CODENAME=quantal
DISTRIB_DESCRIPTION="Ubuntu 12.10"
root@ubuntu:~# apt-get install gddrescue
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  gddrescue
0 upgraded, 1 newly installed, 0 to remove and 489 not upgraded.
Need to get 93.8 kB of archives.
After this operation, 211 kB of additional disk space will be used.
Get:1 http://jp.archive.ubuntu.com/ubuntu/ quantal/universe gddrescue i386 1.16-1 [93.8 kB]
Fetched 93.8 kB in 0s (344 kB/s)   
Selecting previously unselected package gddrescue.
(Reading database ... 152263 files and directories currently installed.)
Unpacking gddrescue (from .../gddrescue_1.16-1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up gddrescue (1.16-1) ...

root@ubuntu:~# time ddrescue /dev/sda /dev/sdc 
ddrescue: Output file exists and is not a regular file.
ddrescue: Use '--force' if you really want to overwrite it, but be
aware that all existing data in the output file will be lost.
Try 'ddrescue --help' for more information.

real	0m0.003s
user	0m0.000s
sys	0m0.000s
root@ubuntu:~# ddrescue --help
GNU ddrescue - Data recovery tool.
Copies data from one file or block device to another,
trying hard to rescue data in case of read errors.

Usage: ddrescue [options] infile outfile [logfile]
You should use a logfile unless you know what you are doing.

Options:
  -h, --help                     display this help and exit
  -V, --version                  output version information and exit
  -a, --min-read-rate=<bytes>    minimum read rate of good areas in bytes/s
  -A, --try-again                mark non-split, non-trimmed blocks as non-tried
  -b, --block-size=<bytes>       sector size of input device [default 512]
  -B, --binary-prefixes          show binary multipliers in numbers [SI]
  -c, --cluster-size=<sectors>   sectors to copy at a time [128]
  -C, --complete-only            do not read new data beyond logfile limits
  -d, --direct                   use direct disc access for input file
  -D, --synchronous              use synchronous writes for output file
  -e, --max-errors=[+]<n>        maximum number of [new] error areas allowed
  -E, --max-error-rate=<bytes>   maximum allowed rate of read errors per second
  -f, --force                    overwrite output device or partition
  -F, --fill=<types>             fill given type blocks with infile data (?*/-+)
  -g, --generate-logfile         generate approximate logfile from partial copy
  -i, --input-position=<bytes>   starting position in input file [0]
  -I, --verify-input-size        verify input file size with size in logfile
  -K, --skip-size=<bytes>        initial size to skip on read error [64 KiB]
  -m, --domain-logfile=<file>    restrict domain to finished blocks in file
  -M, --retrim                   mark all failed blocks as non-trimmed
  -n, --no-split                 do not try to split or retry failed blocks
  -o, --output-position=<bytes>  starting position in output file [ipos]
  -p, --preallocate              preallocate space on disc for output file
  -q, --quiet                    suppress all messages
  -r, --max-retries=<n>          exit after given retries (-1=infinity) [0]
  -R, --reverse                  reverse direction of copy operations
  -s, --max-size=<bytes>         maximum size of input data to be copied
  -S, --sparse                   use sparse writes for output file
  -t, --truncate                 truncate output file to zero size
  -T, --timeout=<interval>       maximum time since last successful read
  -v, --verbose                  be verbose (a 2nd -v gives more)
  -x, --extend-outfile=<bytes>   extend outfile size to be at least this long
Numbers may be followed by a multiplier: b = blocks, k = kB = 10^3 = 1000,
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
Time intervals have the format 1[.5][smhd] or 1/2[smhd].
Report bugs to bug-ddrescue@gnu.org
Ddrescue home page: http://www.gnu.org/software/ddrescue/ddrescue.html
General help using GNU software: http://www.gnu.org/gethelp
root@ubuntu:~# time ddrescue /dev/sda /dev/sdc 
ddrescue: Output file exists and is not a regular file.
ddrescue: Use '--force' if you really want to overwrite it, but be
aware that all existing data in the output file will be lost.
Try 'ddrescue --help' for more information.

real	0m0.003s
user	0m0.000s
sys	0m0.000s
root@ubuntu:~# ddrescue --help
GNU ddrescue - Data recovery tool.
Copies data from one file or block device to another,
trying hard to rescue data in case of read errors.

Usage: ddrescue [options] infile outfile [logfile]
You should use a logfile unless you know what you are doing.

Options:
  -h, --help                     display this help and exit
  -V, --version                  output version information and exit
  -a, --min-read-rate=<bytes>    minimum read rate of good areas in bytes/s
  -A, --try-again                mark non-split, non-trimmed blocks as non-tried
  -b, --block-size=<bytes>       sector size of input device [default 512]
  -B, --binary-prefixes          show binary multipliers in numbers [SI]
  -c, --cluster-size=<sectors>   sectors to copy at a time [128]
  -C, --complete-only            do not read new data beyond logfile limits
  -d, --direct                   use direct disc access for input file
  -D, --synchronous              use synchronous writes for output file
  -e, --max-errors=[+]<n>        maximum number of [new] error areas allowed
  -E, --max-error-rate=<bytes>   maximum allowed rate of read errors per second
  -f, --force                    overwrite output device or partition
  -F, --fill=<types>             fill given type blocks with infile data (?*/-+)
  -g, --generate-logfile         generate approximate logfile from partial copy
  -i, --input-position=<bytes>   starting position in input file [0]
  -I, --verify-input-size        verify input file size with size in logfile
  -K, --skip-size=<bytes>        initial size to skip on read error [64 KiB]
  -m, --domain-logfile=<file>    restrict domain to finished blocks in file
  -M, --retrim                   mark all failed blocks as non-trimmed
  -n, --no-split                 do not try to split or retry failed blocks
  -o, --output-position=<bytes>  starting position in output file [ipos]
  -p, --preallocate              preallocate space on disc for output file
  -q, --quiet                    suppress all messages
  -r, --max-retries=<n>          exit after given retries (-1=infinity) [0]
  -R, --reverse                  reverse direction of copy operations
  -s, --max-size=<bytes>         maximum size of input data to be copied
  -S, --sparse                   use sparse writes for output file
  -t, --truncate                 truncate output file to zero size
  -T, --timeout=<interval>       maximum time since last successful read
  -v, --verbose                  be verbose (a 2nd -v gives more)
  -x, --extend-outfile=<bytes>   extend outfile size to be at least this long
Numbers may be followed by a multiplier: b = blocks, k = kB = 10^3 = 1000,
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
Time intervals have the format 1[.5][smhd] or 1/2[smhd].
Report bugs to bug-ddrescue@gnu.org
Ddrescue home page: http://www.gnu.org/software/ddrescue/ddrescue.html
General help using GNU software: http://www.gnu.org/gethelp
root@ubuntu:~# fdisk -l

Disk /dev/sda: 512.1 GB, 512110190592 bytes
240 heads, 63 sectors/track, 66151 cylinders, total 1000215216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9bdbf079

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   976768064   488384001    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 2021 MB, 2021654528 bytes
63 heads, 62 sectors/track, 1010 cylinders, total 3948544 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009e87d

This doesn't look like a partition table
Probably you selected the wrong device.

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   ?  3223366752  3470046675   123339962   f4  SpeedStor
/dev/sdb2   ?   378192737   710426324   166116794   10  OPUS
/dev/sdb3   ?   225603442   225603451           5   74  Unknown

Partition table entries are not in disk order

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9bdbf079

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     2459647     1228800    7  HPFS/NTFS/exFAT
/dev/sdc2         2459648   976767588   487153970+   7  HPFS/NTFS/exFAT
root@ubuntu:~# time dd if=/dev/sda of=/dev/sdc bs=4096
dd: reading `/dev/sda': Input/output error
275136+0 records in
275136+0 records out
1126957056 bytes (1.1 GB) copied, 14.755 s, 76.4 MB/s

real	0m14.758s
user	0m0.148s
sys	0m2.596s

root@ubuntu:~# time ddrescue -f /dev/sda /dev/sdc 


GNU ddrescue 1.16
Press Ctrl-C to interrupt
rescued:   500106 MB,  errsize:    967 kB,  current rate:    1048 kB/s
   ipos:   500107 MB,   errors:      25,    average rate:   51916 kB/s
   opos:   500107 MB,     time since last successful read:       0 s
Copying non-tried blocks...
ddrescue: write error: No space left on device

real	160m32.673s
user	0m48.815s
sys	51m55.083s
apt-get install ddrescue
cat > chk.sh
mkdir /mnt/sda1
mkdir /mnt/sdb1
mount -o ro /dev/sda1 /mnt/sda1
mount -o ro /dev/sdb1 /mnt/sdb1
rm -f a b
test -a /mnt/sda1/pagefile.sys || (echo NG ; exit)
touch a
umount /mnt/sda1
umount /mnt/sdb1
test -a /mnt/sdb1/pagefile.sys && test /mnt/sda1/pagefile.sys -ot /mnt/sdb1/pagefile.sys && (echo NG ; exit)
touch b
test -a a && test -a b && time dd_rescue /dev/sda /dev/sdb
# time dd_rescue /dev/sda /dev/sdb
dd_resdd_rescue: (info): ipos:    273408.0k, opos:    273408.0k, xferd:    27340dd_rescue: (info): ipos: 312571200.0k, opos: 312571200.0k, xferd: 312571200.0k
                   errs:      0, errxfer:         0.0k, succxfer: 312571200.0k
             +curr.rate:     9741kB/s, avg.rate:    11011kB/s, avg.load:  5.0%
dd_rescue: (info): /dev/sda (312571224.0k): EOF
Summary for /dev/sda -> /dev/sdb:
dd_rescue: (info): ipos: 312571224.0k, opos: 312571224.0k, xferd: 312571224.0k
                   errs:      0, errxfer:         0.0k, succxfer: 312571224.0k
             +curr.rate:     8325kB/s, avg.rate:    11011kB/s, avg.load:  5.0%

real	473m7.103s
user	0m21.533s
sys	23m27.412s

以下は古い記述

cat > chk.sh
mkdir /mnt/sda1
mkdir /mnt/sdb1
mount -o ro /dev/sda1 /mnt/sda1
mount -o ro /dev/sdb1 /mnt/sdb1
rm -f a b
test -a /mnt/sda1/pagefile.sys || (echo NG ; exit)
touch a
umount /mnt/sda1
umount /mnt/sdb1
test -a /mnt/sdb1/pagefile.sys && test /mnt/sda1/pagefile.sys -ot /mnt/sdb1/pagefile.sys && (echo NG ; exit)
touch b
test -a a && test -a b && time dd if=/dev/sda of=/dev/sdb bs=4096

めも

# bash chk.sh
# watch -n 60 "killall -USR1 dd ; dmesg | tail"

78142806+0 records in
78142806+0 records out
320072933376 bytes (320 GB) copied, 13168.9 s, 24.3 MB/s

real	219m28.926s
user	0m37.482s
sys	22m37.029s

通常の速度だな。

expresspci & esata

# time dd if=/dev/sda of=/dev/sdb bs=4096
703773+0 records in
703772+0 records out
2882650112 bytes (2.9 GB) copied, 37.2263 s, 77.4 MB/s
1821401+0 records in
1821400+0 records out
7460454400 bytes (7.5 GB) copied, 97.2543 s, 76.7 MB/s
2948889+0 records in
2948888+0 records out
12078645248 bytes (12 GB) copied, 157.271 s, 76.8 MB/s
()
500107862016 bytes (500 GB) copied, 8328.5 s, 60.0 MB/s

real	138m48.501s
user	1m31.890s
sys	22m15.531s
このページにはhatena以外のサービスからのコンテンツが埋め込まれています。 hatenaによりGoogle AdSense 広告が埋め込まれています。