VMware はディスクスペースを簡単に拡張できるが、拡張しても実際のディスクスペースは OS 側で拡張しなければならない。
★OS
% uname -a
FreeBSD leviathan-vmw 11.2-RELEASE-p3 FreeBSD 11.2-RELEASE-p3 #0:
Thu Sep 6 06:42:08 UTC 2018
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
★拡張前
% fdisk ada3
******* Working on device /dev/ada3 *******
parameters extracted from in-core disklabel are:
cylinders=22192 heads=15 sectors/track=63 (945 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=22192 heads=15 sectors/track=63 (945 blks/cyl)
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 20971377 (10239 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 687/ head 14/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
★VMwareで拡張後
cylinders が増えたことを確認する。
% fdisk ada3
******* Working on device /dev/ada3 *******
parameters extracted from in-core disklabel are:
cylinders=44384 heads=15 sectors/track=63 (945 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=44384 heads=15 sectors/track=63 (945 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 20971377 (10239 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 687/ head 14/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
さて拡張作業。
% sudo fdisk -u ada3
******* Working on device /dev/ada3 *******
parameters extracted from in-core disklabel are:
cylinders=44384 heads=15 sectors/track=63 (945 blks/cyl)
↑★ここの cylinders と blks/cyl をかけ算する。44384x945=41942880
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=44384 heads=15 sectors/track=63 (945 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 20971377 (10239 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 687/ head 14/ sector 63
Do you want to change it? [n] y ★パーティション1を編集する
Supply a decimal value for "sysid (165=FreeBSD)" [165]
Supply a decimal value for "start" [63]
Supply a decimal value for "size" [20971377] 41942817
↑★計算した数字から start の 63 を引いた数字を入れる
Explicitly specify beg/end address ? [n]
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 41942817 (20479 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 351/ head 14/ sector 63
Are we happy with this entry? [n] y ★適用
The data for partition 2 is:
<UNUSED>
Do you want to change it? [n]
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=44384 heads=15 sectors/track=63 (945 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=44384 heads=15 sectors/track=63 (945 blks/cyl)
Information from DOS bootblock is:
1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 41942817 (20479 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 351/ head 14/ sector 63
2: <UNUSED>
3: <UNUSED>
4: <UNUSED>
Should we write new partition table? [n] y ★適用
この後が超重要。
bsdlabel のオプションは -e (EDIT:編集) を使うこと。
間違って
-w に
しないように!!
やっちまうとパーティション情報がバラバラになるかもしれない。
一応単一パーティションだと問題はなかった (元通りにしたら中が見える) が、あまり良い事では無さそう。
% sudo bsdlabel -e /dev/ada3s1
8 partitions:
c: 20971377 0 unused 0 0 # "raw" part, don't edit
d: 20971361 16 4.2BSD 0 0 0
↓
8 partitions:
c: 41942817 0 unused 0 0 # "raw" part, don't edit
d: 41942801 16 4.2BSD 0 0 0
c: には fdisk の size で入力した数値を指定。
d: にはその数値からオフセット分 (16) を引いた数値を指定。
この状態でも一応 mount は出来るが、まだ広げたところが使えないので 、広げた部分を newfs してくれる growfs を使う。
指定するデバイスは広げたパーティション。今回は /dev/ada3s1d。
% sudo growfs /dev/ada3s1d
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/ada3s1d from 10GB to 20GB? [yes/no] yes ←★ぶっ壊れる覚悟が出来たら "yes" で広げる。
super-block backups (for fsck_ffs -b #) at:
21802624, 23085120, 24367616, 25650112, 26932608, 28215104, 29497600, 30780096, 32062592, 33345088, 34627584, 35910080,
37192576, 38475072, 39757568, 41040064
これで df すると容量が増えてる。
念のためちゃんとバックアップは取っておきましょう。
└ G兄
└ G兄
└ G兄
└ G兄
└ G兄
└ G兄
└ G兄
└ G兄
└ 山銀
└ G兄