- まずはDemoLinuxで元ディスクのパーティションを確認。
# fdisk -l /dev/hda
Disk /dev/hda : 255 heads, 63 sectors, 9729 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks ID System
/dev/hda1 * 1 9370 75264493+ 7 HPFS/NTFS
/dev/hda2 9371 9728 2875635 f Win95 Ext'd (LBA)
/dev/hda5 9371 9728 2875603+ 7 HPFS/NTFS
- 作業中のログ等を保存するため、
/dev/hda5はLinuxでも書き込めるFAT32に変更しておこう。
拡張領域(/dev/hda2)がLBAとなっているので、論理区画もLBAにする。
fdiskでt→5→cとすると、/dev/hda5のIDがc、SystemがWin95 FAT32 (LBA)となる。
- 確認のため一旦DemoLinuxを終了してWindowsXPを立ち上げる。
マイ コンピュータのローカル ディスク(F:)は相変らず存在して開くこともでき、
プロパティを見るとNTFSとなっている。
そこでFAT32でフォーマット。
- 電源を切り、IDEのプライマリ スレーブに新しいディスクを接続。
- 再び電源を入れ、BIOS画面へ入って、ディスクドライブが認識されていることを確認。
ジオメトリを自動検出させておこう。
IC35L09AW207-0 Cylinder 39420 Head 16 Precomp 0 Landing Zone 39419 Sector 255
ちなみに元ディスクであるところのST380021Aは
Cylinder 38309 Head 16 Precomp 0 Landing Zone 38308 Sector 255
- WindowsXPを起動し、新しいハードウェアとして検出させておく。
- DemoLinuxを起動。1024vesaでなく1024とするとXが上がらないが、
今回の用途にはおあつらえ向き。
demoでログインしておいてsu。
- さきほどFAT32にしておいた/dev/hda5をマウント。
マウントポイントとしては/mnt/hda5というのが用意されていたりする。
# mount -t vfat /dev/hda5 /mnt/hda5
- あとは何かするたびに出力を/mnt/hda5の下のファイルにリダイレクトさせる
# command >/mnt/hda5/command.out 2>&1
…というのもいいんだけど、scriptを使って丸ごとファイルに落としちゃおう。
# script /mnt/hda5/script.out
- パーティションを確認
# fdisk -l /dev/hdb
Disk /dev/hdb: 255 heads, 63 sectors, 10011 cylinders
Units = cylinders of 16065 * 512 bytes
Disk /dev/hdb doesn't contain a valid partition table
最初はパーティションテーブルが存在しない。
- /dev/hdaのパーティションテーブルを、セクター単位で表示
# fdisk -l -u /dev/hda
Disk /dev/hda: 255 heads, 63 sectors, 9729 cylinders
Units = sectors of 1 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 63 150529049 75264493+ 7 HPFS/NTFS
/dev/hda2 150529050 156280319 2875635 f Win95 Ext'd (LBA)
/dev/hda5 150529113 156280319 2875603+ b Win95 FAT32
- fdiskで/dev/hdbにパーティションを作成。
セクター単位で入力できるように-uオプションを付ける。
# fdisk -u /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI, or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 10011.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-160826714, default 63):
Using default value 63
Last sector or +size or +sizeM or +sizeK (63-160826714, default 160826714): 150529049
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 10011 cylinders
Units = sectors of 1 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 63 150529049 75264493+ 83 Linux
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): L
0 Empty 17 Hidden HPFS/NTF 5c Priam Edisk a6 OpenBSD
1 FAT12 18 AST Windows swa 61 SpeedStor a7 NeXTSTEP
2 XENIX root 1b Hidden Win95 FA 63 GNU HURD or Sys b7 BSDI fs
3 XENIX usr 1c Hidden Win95 FA 64 Novell Netware b8 BSDI swap
4 FAT16 <32M 1e Hidden Win95 FA 65 Novell Netware c1 DRDOS/sec (FAT-
5 Extended 24 NEC DOS 70 DiskSecure Mult c4 DRDOS/sec (FAT-
6 FAT16 3c PartitionMagic 75 PC/IX c6 DRDOS/sec (FAT-
7 HPFS/NTFS 40 Venix 80286 80 Old Minix c7 Syrinx
8 AIX 41 PPC PReP Boot 81 Minix / old Lin db CP/M / CTOS / .
9 AIX bootable 42 SFS 82 Linux swap e1 DOS access
a OS/2 Boot Manag 4d QNX4.x 83 Linux e3 DOS R/O
b Win95 FAT32 4e QNX4.x 2nd part 84 OS/2 hidden C: e4 SpeedStor
c Win95 FAT32 (LB 4f QNX4.x 3rd part 85 Linux extended eb BeOS fs
e Win95 FAT16 (LB 50 OnTrack DM 86 NTFS volume set f1 SpeedStor
f Win95 Ext'd (LB 51 OnTrack DM6 Aux 87 NTFS volume set f4 SpeedStor
10 OPUS 52 CP/M 93 Amoeba f2 DOS secondary
11 Hidden FAT12 53 OnTrack DM6 Aux 94 Amoeba BBT fd Linux raid auto
12 Compaq diagnost 54 OnTrackDM6 a0 IBM Thinkpad hi fe LANstep
14 Hidden FAT16 <3 55 EZ-Drive a5 BSD/386 ff BBT
16 Hidden FAT16 56 Golden Bow
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 10011 cylinders
Units = sectors of 1 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 63 150529049 75264493+ 7 HPFS/NTFS
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
- 転送すべきブロック数を計算
$ bc
bc 1.05
Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
(1505290490-63)/2
75264493
150529049-63+1
150528987
quit
終了セクタ番号から開始セクタ番号を引いて(本当は1を足して)2で割ると、
1セクタ=512バイトなので、
1024バイトすなわちKB単位でのブロック数75264493が得られ、
これは先ほどの-uオプション無しで起動したfdiskの出力結果と一致する。
(+がついてるのは端数0.5が出るためと思われ)
そして転送すべきブロック数は終了セクタ番号-開始セクタ番号+1で150528987。
- で、いよいよdd
# dd if=/dev/hda1 of=/dev/hdb1 bs=512 count=150528987 conv=noerror,sync
とりあえず開始は17時過ぎ。
- 時間がかかりそうなので、この節は一旦打ち切り。
動きがありましたら、節を改めてお伝えいたします。
なお、画面表示の詳細は、
作業が終わってkasiwaがWindowsXPでオンラインにならないと日記に書けません。
*2