- ターゲットマシンはSATAの口が2つしかない
- 別なマシンに2TB×2を付けて、GEOM Gateでexport
- ターゲットマシンのgmirrorにaddしてrebuild
あいかわらずごちゃごちゃやったメモなので、これが正しいやり方かどうかわかりません。真似する人は気を付けてどうぞ。
- 2TBのHDDでgmirrorする。
ggated# gmirror label gm0 ada1 ada2 ggated# gmirror status Name Status Components mirror/gm0 COMPLETE ada1 (ACTIVE) ada2 (ACTIVE) ggated# gmirror list gm0 Geom name: gm0 State: COMPLETE Components: 2 Balance: load Slice: 4096 Flags: NONE GenID: 0 SyncID: 1 ID: 1151407792 Providers: 1. Name: mirror/gm0 Mediasize: 2000398933504 (1.8T) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r0w0e0 Consumers: 1. Name: ada1 Mediasize: 2000398934016 (1.8T) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r1w1e1 State: ACTIVE Priority: 0 Flags: NONE GenID: 0 SyncID: 1 ID: 87429895 2. Name: ada2 Mediasize: 2000398934016 (1.8T) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r1w1e1 State: ACTIVE Priority: 1 Flags: NONE GenID: 0 SyncID: 1 ID: 378337228
- growfsするためにgptを確認。
ggate# gpart list mirror/gm0 Geom name: mirror/gm0 modified: false state: CORRUPT fwheads: 255 fwsectors: 63 last: 488281215 first: 34 entries: 128 scheme: GPT Providers: 1. Name: mirror/gm0p1 Mediasize: 65536 (64k) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 1024 Mode: r0w0e0 rawuuid: 03ccc2e4-406c-11e1-a009-0015c5fc6231 rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f label: (null) length: 65536 offset: 17408 type: freebsd-boot index: 1 end: 161 start: 34 2. Name: mirror/gm0p2 Mediasize: 245886877696 (229G) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 1024 Mode: r0w0e0 rawuuid: 0fbf6ea5-406c-11e1-a009-0015c5fc6231 rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b label: (null) length: 245886877696 offset: 82944 type: freebsd-ufs index: 2 end: 480247969 start: 162 3. Name: mirror/gm0p3 Mediasize: 4112515072 (3.9G) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 1024 Mode: r0w0e0 rawuuid: 162d28ea-406c-11e1-a009-0015c5fc6231 rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b label: (null) length: 4112515072 offset: 245886960640 type: freebsd-swap index: 3 end: 488280225 start: 480247970 Consumers: 1. Name: mirror/gm0 Mediasize: 2000398933504 (1.8T) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r0w0e0 ggated# gpart show -l mirror/gm0 => 34 488281182 mirror/gm0 GPT (1.8T) [CORRUPT] 34 128 1 (null) (64k) 162 480247808 2 (null) (229G) 480247970 8032256 3 (null) (3.9G) 488280226 990 - free - (495k)
- 容量の違うHDDで無理やりmirrorしたので、gptパーティション情報が不正(CORRUPT)になる。で、これのリカバリをしないとなにもできない。
ggated# gpart recover mirror/gm0 mirror/gm0 recovered ggated# gpart show -l mirror/gm0 => 34 3907029100 mirror/gm0 GPT (1.8T) 34 128 1 (null) (64k) 162 480247808 2 (null) (229G) 480247970 8032256 3 (null) (3.9G) 488280226 3418748908 - free - (1.6T)
- 空き容量がきちんと表示され、CORRUPT表示も消えたので、ダメモトでreizeしてみる。
ggated# gpart resize -i 2 mirror/gm0 gpart: autofill: No space left on device
mirror/gm0p3があるのでやっぱり無理(そりゃそうだ)。 - mirror/gm0p3のswapを一旦削除する。
ggated# gpart delete -i 3 mirror/gm0 mirror/gm0p3 deleted ggated# gpart show -l mirror/gm0 => 34 3907029100 mirror/gm0 GPT (1.8T) 34 128 1 (null) (64k) 162 480247808 2 (null) (229G) 480247970 3426781164 - free - (1.6T)
- これでresizeできる。
ggated# gpart resize -i 2 -s 1859G mirror/gm0 mirror/gm0p2 resized ggated# gpart show -l mirror/gm0 => 34 3907029100 mirror/gm0 GPT (1.8T) 34 128 1 (null) (64k) 162 3898605568 2 (null) (1.8T) 3898605730 8423404 - free - (4.0G)
- 新にswapを作る。
ggated# gpart add -t freebsd-swap mirror/gm0 mirror/gm0p3 added ggated# gpart show -l mirror/gm0 => 34 3907029100 mirror/gm0 GPT (1.8T) 34 128 1 (null) (64k) 162 3898605568 2 (null) (1.8T) 3898605730 6 - free - (3.0k) 3898605736 8423392 3 (null) (4.0G) 3907029128 6 - free - (3.0k)
- ついでにlabelを付けてみる。
ggated# gpart modify -l disk0 -i 2 mirror/gm0 mirror/gm0p2 modified ggated# gpart modify -l swap0 -i 3 mirror/gm0 mirror/gm0p3 modified ggated# gpart show -l mirror/gm0 => 34 3907029100 mirror/gm0 GPT (1.8T) 34 128 1 (null) (64k) 162 3898605568 2 disk0 (1.8T) 3898605730 6 - free - (3.0k) 3898605736 8423392 3 swap0 (4.0G) 3907029128 6 - free - (3.0k)
- これでgrowfsできるはずなのでテストしてみる。
ggated# growfs -N /dev/mirror/gm0p2 ...
- エラーがでないのでGo!
ggated# growfs /dev/mirror/gm0p2 We strongly recommend you to make a backup before growing the file system. Did you backup your data (Yes/No)? Yes New file system size is 487325696 frags Warning: 688128 sector(s) cannot be allocated. growfs: 1903280.0MB (3897917440 sectors) block size 32768, fragment size 4096 using 2572 cylinder groups of 740.00MB, 23680 blks, 47360 inodes. with soft updates super-block backups (for fsck -b #) at: 480420032, 481935552, 483451072, 484966592, 486482112, 487997632, 489513152, 491028672, 492544192, ... 3884277952, 3885793472, 3887308992, 3888824512, 3890340032, 3891855552, 3893371072, 3894886592, 3896402112
- mountしてみる。
ggated# mount -t ufs /dev/mirror/gm0p2 /mnt mount: /dev/mirror/gm0p2 : Operation not permitted ggated# tail /var/log/messages Jan 24 10:05:38 ggate kernel: WARNING: R/W mount of / denied. Filesystem is not clean - run fsck Jan 24 10:05:38 ggate kernel: WARNING: Forced mount will invalidate journal contents Jan 24 10:12:30 ggate kernel: WARNING: R/W mount of / denied. Filesystem is not clean - run fsck Jan 24 10:12:30 ggate kernel: WARNING: Forced mount will invalidate journal contents Jan 24 10:13:22 ggate kernel: WARNING: R/W mount of / denied. Filesystem is not clean - run fsck Jan 24 10:13:22 ggate kernel: WARNING: Forced mount will invalidate journal contents Jan 24 10:14:48 ggate kernel: WARNING: R/W mount of / denied. Filesystem is not clean - run fsck Jan 24 10:14:48 ggate kernel: WARNING: Forced mount will invalidate journal contents Jan 24 10:24:20 ggate kernel: WARNING: R/W mount of / denied. Filesystem is not clean - run fsck Jan 24 10:24:20 ggate kernel: WARNING: Forced mount will invalidate journal contents
- fsck必要ですかそうですか。
ggated# fsck /dev/mirror/gm0p2 fsck: Could not determine filesystem type ggated# fsck_ffs /dev/mirror/gm0p2 ** /dev/mirror/gm0p2 USE JOURNAL? [yn] y ** SU+J Recovering /dev/mirror/gm0p2 ** Reading 33554432 byte journal from inode 4. RECOVER? [yn] y ** Building recovery table. ** Resolving unreferenced inode list. ** Processing journal entries. WRITE CHANGES? [yn] y ** 8 journal records in 2560 bytes for 10.00% utilization ** Freed 1 inodes (0 dirs) 0 blocks, and 3 frags. ***** FILE SYSTEM MARKED CLEAN *****
- 今度こそ!
ggated# mount -t ufs /dev/mirror/gm0p2 /mnt ggated# df -h Filesystem Size Used Avail Capacity Mounted on /dev/ada0p2 224G 666M 205G 0% / devfs 1.0k 1.0k 0B 100% /dev /dev/mirror/gm0p2 1.8T 93G 1.6T 6% /mnt