Loose-Info.com
Last Update 2014/03/11
TOP - Unix系OS - FreeBSD - fdisk(8)

スライステーブルの操作を行います。(root権限)

fdisk オプション1 デバイス
オプション1(任意) 無し : スライステーブルを表示 -s : 概要を表示 -I : ディスク全体が一つのFreeBSDスライスとなるようにセクター0を初期化 -i : ディスクのセクター0を初期化、編集 -u : ディスクのセクター0を編集 -1234 : スライスを指定 -v : 表示を冗長にする -B : ディスクのセクター0に含まれるブートコードを再初期化 デバイス 操作の対象となるデバイスの名前

※ オプションなどは個人的に重要と考えられるものを記述しており、記載の無いものは、manページや関連書籍などを参照願います。
※ 実行例の記述は、不要と考えられる部分の削除などの修正を行ったものを掲載しています。
※ 実行例の実行環境はFreeBSD 9.1です。また、実行例はデバイスとして8GBのUSBメモリーを使用しています。

(例) オプション無し
# fdisk /dev/da0

実行結果
******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 15647247 (7640 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 973/ head 254/ sector 63 The data for partition 2 is: <UNUSED> The data for partition 3 is: <UNUSED> The data for partition 4 is: <UNUSED>

(例) オプション -s
# fdisk -s /dev/da0

実行結果
# fdisk -s /dev/da0 /dev/da0: 974 cyl 255 hd 63 sec Part Start Size Type Flags 1: 63 15647247 0xa5 0x80

(例) オプション -I
実行結果(出力部分は灰色表示)
# dd if=/dev/zero of=/dev/da0 bs=512 count=32 ← 既存の情報の消去 32+0 records in 32+0 records out 16384 bytes transferred in 0.469043 secs (34931 bytes/sec) # fdisk -s /dev/da0 fdisk: invalid fdisk partition table found fdisk: read_s0: No such file or directory # fdisk -I -v /dev/da0 ← -vオプションで詳細も表示 ******* Working on device /dev/da0 ******* fdisk: invalid fdisk partition table found parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Information from DOS bootblock is: 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 15647247 (7640 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 973/ head 254/ sector 63 2: <UNUSED> 3: <UNUSED> 4: <UNUSED> # fdisk -s /dev/da0 /dev/da0: 974 cyl 255 hd 63 sec Part Start Size Type Flags 1: 63 15647247 0xa5 0x80

(例) オプション -i
実行結果(出力部分は灰色表示)
# dd if=/dev/zero of=/dev/da0 bs=512 count=32 ← 既存の情報の消去 32+0 records in 32+0 records out 16384 bytes transferred in 0.469043 secs (34931 bytes/sec) # fdisk -s /dev/da0 fdisk: invalid fdisk partition table found fdisk: read_s0: No such file or directory # fdisk -i /dev/da0 ******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Do you want to change our idea of what BIOS thinks ? [n] fdisk: invalid fdisk partition table found Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 15647247 (7640 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 973/ head 254/ sector 63 Do you want to change it? [n] y The static data for the slice 1 has been reinitialized to: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 15647247 (7640 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 973/ head 254/ sector 63 Supply a decimal value for "sysid (165=FreeBSD)" [165] Supply a decimal value for "start" [63] Supply a decimal value for "size" [15647247] 7823000 fdisk: WARNING: partition does not end on a cylinder boundary fdisk: WARNING: this may confuse the BIOS or some operating systems Correct this automatically? [n] y fdisk: WARNING: adjusting size of partition to 7807527 Explicitly specify beg/end address ? [n] sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 7807527 (3812 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 485/ head 254/ sector 63 Are we happy with this entry? [n] y The data for partition 2 is: <UNUSED> Do you want to change it? [n] y Supply a decimal value for "sysid (165=FreeBSD)" [0] 165 Supply a decimal value for "start" [0] 7807590 Supply a decimal value for "size" [0] 7823000 fdisk: WARNING: partition does not end on a cylinder boundary fdisk: WARNING: this may confuse the BIOS or some operating systems Correct this automatically? [n] y fdisk: WARNING: adjusting size of partition to 7807590 Explicitly specify beg/end address ? [n] sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 7807590 (3812 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 Are we happy with this entry? [n] y The data for partition 3 is: <UNUSED> Do you want to change it? [n] The data for partition 4 is: <UNUSED> Do you want to change it? [n] Partition 1 is marked active Do you want to change the active partition? [n] We haven't changed the partition table yet. This is your last chance. parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Information from DOS bootblock is: 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 7807527 (3812 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 485/ head 254/ sector 63 2: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 7807590 (3812 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 3: <UNUSED> 4: <UNUSED> Should we write new partition table? [n] y # fdisk -s /dev/da0 /dev/da0: 974 cyl 255 hd 63 sec Part Start Size Type Flags 1: 63 7807527 0xa5 0x80 2: 7807590 7807590 0xa5 0x00

(例)オプション -u
実行結果(オプション-iの例をそのまま利用・出力部分は灰色表示)
# fdisk -u /dev/da0 ******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Do you want to change our idea of what BIOS thinks ? [n] Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 7807527 (3812 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 485/ head 254/ sector 63 Do you want to change it? [n] The data for partition 2 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 7807590 (3812 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 Do you want to change it? [n] y Supply a decimal value for "sysid (165=FreeBSD)" [165] Supply a decimal value for "start" [7807590] Supply a decimal value for "size" [7807590] 3904000 fdisk: WARNING: partition does not end on a cylinder boundary fdisk: WARNING: this may confuse the BIOS or some operating systems Correct this automatically? [n] y fdisk: WARNING: adjusting size of partition to 3903795 Explicitly specify beg/end address ? [n] sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 3903795 (1906 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 728/ head 254/ sector 63 Are we happy with this entry? [n] y The data for partition 3 is: <UNUSED> Do you want to change it? [n] y Supply a decimal value for "sysid (165=FreeBSD)" [0] 165 Supply a decimal value for "start" [0] 11711385 Supply a decimal value for "size" [0] 3904000 fdisk: WARNING: partition does not end on a cylinder boundary fdisk: WARNING: this may confuse the BIOS or some operating systems Correct this automatically? [n] y fdisk: WARNING: adjusting size of partition to 3903795 Explicitly specify beg/end address ? [n] sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 11711385, size 3903795 (1906 Meg), flag 0 beg: cyl 729/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 Are we happy with this entry? [n] y The data for partition 4 is: <UNUSED> Do you want to change it? [n] Partition 1 is marked active Do you want to change the active partition? [n] We haven't changed the partition table yet. This is your last chance. parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Information from DOS bootblock is: 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 7807527 (3812 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 485/ head 254/ sector 63 2: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 3903795 (1906 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 728/ head 254/ sector 63 3: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 11711385, size 3903795 (1906 Meg), flag 0 beg: cyl 729/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 4: <UNUSED> Should we write new partition table? [n] y # fdisk -s /dev/da0 /dev/da0: 974 cyl 255 hd 63 sec Part Start Size Type Flags 1: 63 7807527 0xa5 0x80 2: 7807590 3903795 0xa5 0x00 3: 11711385 3903795 0xa5 0x00

(例) オプション -1234
実行結果(オプション-uの例をそのまま利用・出力部分は灰色表示)
# fdisk -u -2 /dev/da0 ******* Working on device /dev/da0 ******* parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Do you want to change our idea of what BIOS thinks ? [n] Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 2 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 7807590, size 3903795 (1906 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 728/ head 254/ sector 63 Do you want to change it? [n] y Supply a decimal value for "sysid (165=FreeBSD)" [12] 131 Supply a decimal value for "start" [7807590] Supply a decimal value for "size" [3903795] Explicitly specify beg/end address ? [n] sysid 131 (0x83),(Linux native) start 7807590, size 3903795 (1906 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 728/ head 254/ sector 63 Are we happy with this entry? [n] y Partition 1 is marked active Do you want to change the active partition? [n] We haven't changed the partition table yet. This is your last chance. parameters extracted from in-core disklabel are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=974 heads=255 sectors/track=63 (16065 blks/cyl) Information from DOS bootblock is: 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 63, size 7807527 (3812 Meg), flag 80 (active) beg: cyl 0/ head 1/ sector 1; end: cyl 485/ head 254/ sector 63 2: sysid 131 (0x83),(Linux native) start 7807590, size 3903795 (1906 Meg), flag 0 beg: cyl 486/ head 0/ sector 1; end: cyl 728/ head 254/ sector 63 3: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 11711385, size 3903795 (1906 Meg), flag 0 beg: cyl 729/ head 0/ sector 1; end: cyl 971/ head 254/ sector 63 4: <UNUSED> Should we write new partition table? [n] y