| 1 | [[PageOutline]] |
| 2 | |
| 3 | = testing xfs_growfs = |
| 4 | * 結論 |
| 5 | * diskの後方に向けて拡張するのは、開始セクタを変えずにパーティションを切り直し、リマウントしてxfs_growfsすればよい |
| 6 | * diskの前方に向けて拡張するのは、パーティション内容をあらかじめdd等で移動する手間が必要 |
| 7 | * データ総量が十分小さければ、前方にあらかじめ別のパーティションを切り、cpした上で古いパーティションを削除して、新しいパーティションを後方拡張する方が操作ミスを起こしにくいと思われる |
| 8 | * LVMを使えばより単純になると思われる |
| 9 | * ただし、LVM自体を扱う手間が増える(障害時の復旧手順が複雑化) |
| 10 | |
| 11 | == expanding /dev/sdb1 == |
| 12 | 1. mkfs |
| 13 | * sudo fdisk /dev/sdb -l |
| 14 | {{{ |
| 15 | Disk /dev/sdb: 4294 MB, 4294967296 bytes |
| 16 | 255 heads, 63 sectors/track, 522 cylinders |
| 17 | Units = cylinders of 16065 * 512 = 8225280 bytes |
| 18 | Sector size (logical/physical): 512 bytes / 512 bytes |
| 19 | I/O size (minimum/optimal): 512 bytes / 512 bytes |
| 20 | Disk identifier: 0x00000000 |
| 21 | |
| 22 | Disk /dev/sdb doesn't contain a valid partition table |
| 23 | }}} |
| 24 | * sudo fdisk /dev/sdb |
| 25 | {{{ |
| 26 | Command (m for help): n |
| 27 | Command action |
| 28 | e extended |
| 29 | p primary partition (1-4) |
| 30 | p |
| 31 | Partition number (1-4): 1 |
| 32 | First cylinder (1-522, default 1): |
| 33 | Using default value 1 |
| 34 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): +1G |
| 35 | |
| 36 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 37 | }}} |
| 38 | * sudo mkfs.xfs /dev/sdb1 |
| 39 | {{{ |
| 40 | meta-data=/dev/sdb1 isize=256 agcount=4, agsize=66266 blks |
| 41 | = sectsz=512 attr=2 |
| 42 | data = bsize=4096 blocks=265064, imaxpct=25 |
| 43 | = sunit=0 swidth=0 blks |
| 44 | naming =version 2 bsize=4096 ascii-ci=0 |
| 45 | log =internal log bsize=4096 blocks=2560, version=2 |
| 46 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 47 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 48 | }}} |
| 49 | * sudo blkid /dev/sdb1 |
| 50 | {{{ |
| 51 | /dev/sdb1: UUID="e47dbfff-97ca-43b8-9a29-89700956a7dd" TYPE="xfs" |
| 52 | }}} |
| 53 | 1. mount |
| 54 | * sudo mkdir /mnt/sdb1 |
| 55 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 56 | * df /mnt/sdb1/ -h |
| 57 | {{{ |
| 58 | /dev/sdb1 1.1G 4.2M 1022M 1% /mnt/sdb1 |
| 59 | }}} |
| 60 | 1. テストデータの用意 |
| 61 | * sudo dd if=/dev/urandom of=/mnt/sdb1/rand.10M bs=1024 count=10240 |
| 62 | * cp /mnt/sdb1/rand.10M . |
| 63 | 1. remake partition |
| 64 | * sudo umount /mnt/sdb1/ |
| 65 | * sudo fdisk /dev/sdb |
| 66 | {{{ |
| 67 | Command (m for help): d |
| 68 | Selected partition 1 |
| 69 | |
| 70 | Command (m for help): n |
| 71 | Command action |
| 72 | e extended |
| 73 | p primary partition (1-4) |
| 74 | p |
| 75 | Partition number (1-4): 1 |
| 76 | First cylinder (1-522, default 1): |
| 77 | Using default value 1 |
| 78 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): |
| 79 | Using default value 522 |
| 80 | |
| 81 | /dev/sdb1 1 522 4192933+ 83 Linux |
| 82 | }}} |
| 83 | * sudo blkid /dev/sdb1 |
| 84 | {{{ |
| 85 | /dev/sdb1: UUID="e47dbfff-97ca-43b8-9a29-89700956a7dd" TYPE="xfs" |
| 86 | }}} |
| 87 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 88 | * df /mnt/sdb1/ -h |
| 89 | {{{ |
| 90 | /dev/sdb1 1.1G 15M 1012M 2% /mnt/sdb1 |
| 91 | }}} |
| 92 | * sha1sum -b rand.10M /mnt/sdb1/rand.10M |
| 93 | {{{ |
| 94 | 72d3a67ecd23e77bbc57eb959b945c6cbdae58e1 *rand.10M |
| 95 | 72d3a67ecd23e77bbc57eb959b945c6cbdae58e1 */mnt/sdb1/rand.10M |
| 96 | }}} |
| 97 | 1. resize xfs filesystem |
| 98 | * sudo xfs_growfs /mnt/sdb1/ |
| 99 | {{{ |
| 100 | meta-data=/dev/sdb1 isize=256 agcount=4, agsize=66266 blks |
| 101 | = sectsz=512 attr=2 |
| 102 | data = bsize=4096 blocks=265064, imaxpct=25 |
| 103 | = sunit=0 swidth=0 blks |
| 104 | naming =version 2 bsize=4096 ascii-ci=0 |
| 105 | log =internal bsize=4096 blocks=2560, version=2 |
| 106 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 107 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 108 | data blocks changed from 265064 to 1048233 |
| 109 | }}} |
| 110 | * df /mnt/sdb1/ -h |
| 111 | {{{ |
| 112 | Filesystem Size Used Avail Use% Mounted on |
| 113 | /dev/sdb1 4.0G 15M 4.0G 1% /mnt/sdb1 |
| 114 | }}} |
| 115 | * sha1sum -b rand.10M /mnt/sdb1/rand.10M |
| 116 | {{{ |
| 117 | 72d3a67ecd23e77bbc57eb959b945c6cbdae58e1 *rand.10M |
| 118 | 72d3a67ecd23e77bbc57eb959b945c6cbdae58e1 */mnt/sdb1/rand.10M |
| 119 | }}} |
| 120 | |
| 121 | * 問題なく拡張された |
| 122 | |
| 123 | == test with 3 partitions == |
| 124 | 1. make partitions |
| 125 | * sudo fdisk /dev/sdb |
| 126 | * snip |
| 127 | * sudo fdisk /dev/sdb -l |
| 128 | {{{ |
| 129 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 130 | /dev/sdb2 133 394 2104515 83 Linux |
| 131 | /dev/sdb3 395 522 1028160 83 Linux |
| 132 | }}} |
| 133 | 1. mkfs |
| 134 | * sudo mkfs.xfs /dev/sdb1 |
| 135 | {{{ |
| 136 | meta-data=/dev/sdb1 isize=256 agcount=4, agsize=66266 blks |
| 137 | = sectsz=512 attr=2 |
| 138 | data = bsize=4096 blocks=265064, imaxpct=25 |
| 139 | = sunit=0 swidth=0 blks |
| 140 | naming =version 2 bsize=4096 ascii-ci=0 |
| 141 | log =internal log bsize=4096 blocks=2560, version=2 |
| 142 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 143 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 144 | }}} |
| 145 | * sudo mkfs.xfs /dev/sdb2 |
| 146 | {{{ |
| 147 | meta-data=/dev/sdb2 isize=256 agcount=4, agsize=131532 blks |
| 148 | = sectsz=512 attr=2 |
| 149 | data = bsize=4096 blocks=526128, imaxpct=25 |
| 150 | = sunit=0 swidth=0 blks |
| 151 | naming =version 2 bsize=4096 ascii-ci=0 |
| 152 | log =internal log bsize=4096 blocks=2560, version=2 |
| 153 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 154 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 155 | }}} |
| 156 | * sudo mkfs.xfs /dev/sdb3 |
| 157 | {{{ |
| 158 | meta-data=/dev/sdb3 isize=256 agcount=4, agsize=64260 blks |
| 159 | = sectsz=512 attr=2 |
| 160 | data = bsize=4096 blocks=257040, imaxpct=25 |
| 161 | = sunit=0 swidth=0 blks |
| 162 | naming =version 2 bsize=4096 ascii-ci=0 |
| 163 | log =internal log bsize=4096 blocks=1200, version=2 |
| 164 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 165 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 166 | }}} |
| 167 | * sudo blkid /dev/sdb![123] |
| 168 | {{{ |
| 169 | /dev/sdb1: UUID="9065c3c2-ab3d-4460-978e-e37c88f31f5f" TYPE="xfs" |
| 170 | /dev/sdb2: UUID="b9515b82-4d3c-457d-8d32-330cfea692df" TYPE="xfs" |
| 171 | /dev/sdb3: UUID="17374506-2cb1-4451-a5a8-b15cb1410870" TYPE="xfs" |
| 172 | }}} |
| 173 | 1. mount |
| 174 | * sudo mkdir /mnt/sdb1 |
| 175 | * sudo mkdir /mnt/sdb2 |
| 176 | * sudo mkdir /mnt/sdb3 |
| 177 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 178 | * sudo mount /dev/sdb2 /mnt/sdb2 |
| 179 | * sudo mount /dev/sdb3 /mnt/sdb3 |
| 180 | * df -h |
| 181 | {{{ |
| 182 | /dev/sdb1 1.1G 4.2M 1022M 1% /mnt/sdb1 |
| 183 | /dev/sdb2 2.0G 4.2M 2.0G 1% /mnt/sdb2 |
| 184 | /dev/sdb3 1000M 4.2M 996M 1% /mnt/sdb3 |
| 185 | }}} |
| 186 | 1. テストデータの用意 |
| 187 | * sudo dd if=/dev/urandom of=/mnt/sdb1/rand1.10M bs=1024 count=10240 |
| 188 | * sudo dd if=/dev/urandom of=/mnt/sdb2/rand2.10M bs=1024 count=10240 |
| 189 | * sudo dd if=/dev/urandom of=/mnt/sdb3/rand3.10M bs=1024 count=10240 |
| 190 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 191 | {{{ |
| 192 | 11b2836d9c88f3890224f5d4250e2dd86ddca3e6 */mnt/sdb1/rand1.10M |
| 193 | 3b2fb16c6416b5c6314c396f03275fd20ff8f24b */mnt/sdb2/rand2.10M |
| 194 | 0fb674e54da58858fa1a825f724f5e0c782a8a04 */mnt/sdb3/rand3.10M |
| 195 | }}} |
| 196 | |
| 197 | === /dev/sdb2をdisk後方に向けて拡張 === |
| 198 | 1. remake partition |
| 199 | * sudo umount /dev/sdb![123] |
| 200 | * sudo fdisk /dev/sdb |
| 201 | {{{ |
| 202 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 203 | /dev/sdb2 133 394 2104515 83 Linux |
| 204 | /dev/sdb3 395 522 1028160 83 Linux |
| 205 | |
| 206 | Command (m for help): d |
| 207 | Partition number (1-4): 3 |
| 208 | |
| 209 | Command (m for help): d |
| 210 | Partition number (1-4): 2 |
| 211 | |
| 212 | Command (m for help): n |
| 213 | Command action |
| 214 | e extended |
| 215 | p primary partition (1-4) |
| 216 | p |
| 217 | Partition number (1-4): 2 |
| 218 | First cylinder (133-522, default 133): |
| 219 | Using default value 133 |
| 220 | Last cylinder, +cylinders or +size{K,M,G} (133-522, default 522): |
| 221 | Using default value 522 |
| 222 | |
| 223 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 224 | /dev/sdb2 133 522 3132675 83 Linux |
| 225 | }}} |
| 226 | 1. resize xfs filesystem |
| 227 | * sudo mount /dev/sdb2 /mnt/sdb2 |
| 228 | * df -h |
| 229 | {{{ |
| 230 | /dev/sdb2 2.0G 15M 2.0G 1% /mnt/sdb2 |
| 231 | }}} |
| 232 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 233 | {{{ |
| 234 | 3b2fb16c6416b5c6314c396f03275fd20ff8f24b */mnt/sdb2/rand2.10M |
| 235 | }}} |
| 236 | * sudo xfs_growfs /mnt/sdb2/ |
| 237 | {{{ |
| 238 | meta-data=/dev/sdb2 isize=256 agcount=4, agsize=131532 blks |
| 239 | = sectsz=512 attr=2 |
| 240 | data = bsize=4096 blocks=526128, imaxpct=25 |
| 241 | = sunit=0 swidth=0 blks |
| 242 | naming =version 2 bsize=4096 ascii-ci=0 |
| 243 | log =internal bsize=4096 blocks=2560, version=2 |
| 244 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 245 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 246 | data blocks changed from 526128 to 783168 |
| 247 | }}} |
| 248 | * sudo blkid /dev/sdb![123] |
| 249 | {{{ |
| 250 | /dev/sdb1: UUID="9065c3c2-ab3d-4460-978e-e37c88f31f5f" TYPE="xfs" |
| 251 | /dev/sdb2: UUID="b9515b82-4d3c-457d-8d32-330cfea692df" TYPE="xfs" |
| 252 | }}} |
| 253 | * df -h |
| 254 | {{{ |
| 255 | /dev/sdb2 3.0G 15M 3.0G 1% /mnt/sdb2 |
| 256 | }}} |
| 257 | |
| 258 | * 問題なく拡張された |
| 259 | |
| 260 | === /dev/sdb2をdisk前方に向けて拡張 === |
| 261 | ==== 適当でない手順 ==== |
| 262 | ===== remake partition with name sdb1 ===== |
| 263 | * sudo umount /dev/sdb![123] |
| 264 | * sudo fdisk /dev/sdb |
| 265 | {{{ |
| 266 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 267 | /dev/sdb2 133 522 3132675 83 Linux |
| 268 | |
| 269 | |
| 270 | Command (m for help): d |
| 271 | Partition number (1-4): 1 |
| 272 | |
| 273 | Command (m for help): d |
| 274 | Selected partition 2 |
| 275 | |
| 276 | Command (m for help): n |
| 277 | Command action |
| 278 | e extended |
| 279 | p primary partition (1-4) |
| 280 | p |
| 281 | Partition number (1-4): 1 |
| 282 | First cylinder (1-522, default 1): |
| 283 | Using default value 1 |
| 284 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): |
| 285 | Using default value 522 |
| 286 | |
| 287 | |
| 288 | /dev/sdb1 1 522 4192933+ 83 Linux |
| 289 | }}} |
| 290 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 291 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 292 | {{{ |
| 293 | 11b2836d9c88f3890224f5d4250e2dd86ddca3e6 */mnt/sdb1/rand1.10M |
| 294 | }}} |
| 295 | |
| 296 | * 当然だがsdb2ではなくsdb1がmountされてしまう |
| 297 | |
| 298 | ===== remake partition with name sdb2 ===== |
| 299 | * sudo umount /dev/sdb![123] |
| 300 | * sudo fdisk /dev/sdb |
| 301 | {{{ |
| 302 | /dev/sdb1 1 522 4192933+ 83 Linux |
| 303 | |
| 304 | Command (m for help): d |
| 305 | Selected partition 1 |
| 306 | |
| 307 | Command (m for help): n |
| 308 | Command action |
| 309 | e extended |
| 310 | p primary partition (1-4) |
| 311 | p |
| 312 | Partition number (1-4): 2 |
| 313 | First cylinder (1-522, default 1): |
| 314 | Using default value 1 |
| 315 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): |
| 316 | Using default value 522 |
| 317 | |
| 318 | /dev/sdb2 1 522 4192933+ 83 Linux |
| 319 | }}} |
| 320 | * sudo mount /dev/sdb2 /mnt/sdb2 |
| 321 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 322 | {{{ |
| 323 | 11b2836d9c88f3890224f5d4250e2dd86ddca3e6 */mnt/sdb2/rand1.10M |
| 324 | }}} |
| 325 | |
| 326 | * やはりsdb1の内容がmountされる |
| 327 | |
| 328 | ===== overwrite sdb1 with 0x00 and remake partition ===== |
| 329 | * sudo umount /dev/sdb![123] |
| 330 | * sudo fdisk /dev/sdb |
| 331 | {{{ |
| 332 | /dev/sdb2 1 522 4192933+ 83 Linux |
| 333 | |
| 334 | |
| 335 | Command (m for help): d |
| 336 | Selected partition 2 |
| 337 | |
| 338 | Command (m for help): n |
| 339 | Command action |
| 340 | e extended |
| 341 | p primary partition (1-4) |
| 342 | p |
| 343 | Partition number (1-4): 1 |
| 344 | First cylinder (1-522, default 1): |
| 345 | Using default value 1 |
| 346 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): 132 |
| 347 | |
| 348 | Command (m for help): n |
| 349 | Command action |
| 350 | e extended |
| 351 | p primary partition (1-4) |
| 352 | p |
| 353 | Partition number (1-4): 2 |
| 354 | First cylinder (133-522, default 133): |
| 355 | Using default value 133 |
| 356 | Last cylinder, +cylinders or +size{K,M,G} (133-522, default 522): |
| 357 | Using default value 522 |
| 358 | |
| 359 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 360 | /dev/sdb2 133 522 3132675 83 Linux |
| 361 | }}} |
| 362 | * sudo dd if=/dev/zero of=/dev/sdb1 bs=1024 count=10240 |
| 363 | * sudo mount /dev/sdb1 /mnt/sdb1 -t xfs |
| 364 | {{{ |
| 365 | [ 8848.630996] XFS: bad magic number |
| 366 | [ 8848.630996] XFS: SB validate failed |
| 367 | }}} |
| 368 | * sudo mount /dev/sdb2 /mnt/sdb2 |
| 369 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 370 | {{{ |
| 371 | 3b2fb16c6416b5c6314c396f03275fd20ff8f24b */mnt/sdb2/rand2.10M |
| 372 | }}} |
| 373 | |
| 374 | * sudo umount /dev/sdb![123] |
| 375 | * sudo fdisk /dev/sdb |
| 376 | {{{ |
| 377 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 378 | /dev/sdb2 133 522 3132675 83 Linux |
| 379 | |
| 380 | Command (m for help): d |
| 381 | Partition number (1-4): 1 |
| 382 | |
| 383 | Command (m for help): d |
| 384 | Selected partition 2 |
| 385 | |
| 386 | Command (m for help): n |
| 387 | Command action |
| 388 | e extended |
| 389 | p primary partition (1-4) |
| 390 | p |
| 391 | Partition number (1-4): 2 |
| 392 | First cylinder (1-522, default 1): |
| 393 | Using default value 1 |
| 394 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): |
| 395 | Using default value 522 |
| 396 | |
| 397 | |
| 398 | /dev/sdb2 1 522 4192933+ 83 Linux |
| 399 | }}} |
| 400 | * sudo mount /dev/sdb2 /mnt/sdb2 -t xfs |
| 401 | {{{ |
| 402 | [ 9060.520973] XFS: bad magic number |
| 403 | [ 9060.520973] XFS: SB validate failed |
| 404 | }}} |
| 405 | |
| 406 | * 全くmount出来なくなる |
| 407 | |
| 408 | ==== 適当(と思われる)方法 ==== |
| 409 | 1. mount |
| 410 | * sudo fdisk -l /dev/sdb |
| 411 | {{{ |
| 412 | /dev/sdb1 1 132 1060258+ 83 Linux |
| 413 | /dev/sdb2 133 522 3132675 83 Linux |
| 414 | }}} |
| 415 | * sudo fdisk -lu /dev/sdb |
| 416 | {{{ |
| 417 | /dev/sdb1 63 2120579 1060258+ 83 Linux |
| 418 | /dev/sdb2 2120580 8385929 3132675 83 Linux |
| 419 | }}} |
| 420 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 421 | * sudo mount /dev/sdb2 /mnt/sdb2 |
| 422 | * df -h |
| 423 | {{{ |
| 424 | /dev/sdb1 1.1G 15M 1012M 2% /mnt/sdb1 |
| 425 | /dev/sdb2 3.0G 15M 3.0G 1% /mnt/sdb2 |
| 426 | }}} |
| 427 | * sha1sum -b /mnt/sdb*/rand*.10M |
| 428 | {{{ |
| 429 | 11b2836d9c88f3890224f5d4250e2dd86ddca3e6 */mnt/sdb1/rand1.10M |
| 430 | 3b2fb16c6416b5c6314c396f03275fd20ff8f24b */mnt/sdb2/rand2.10M |
| 431 | }}} |
| 432 | 1. テストデータの用意 |
| 433 | * sudo dd if=/dev/urandom of=/mnt/sdb1/rand1.900M bs=512 count=921600 |
| 434 | * sudo dd if=/dev/urandom of=/mnt/sdb2/rand2.2900M bs=1024 count=2969600 |
| 435 | * sudo dd if=/dev/urandom of=/mnt/sdb1/rand1.max bs=512 |
| 436 | * sudo dd if=/dev/urandom of=/mnt/sdb2/rand2.max bs=512 & |
| 437 | * df -h |
| 438 | {{{ |
| 439 | /dev/sdb1 1.1G 1.1G 20K 100% /mnt/sdb1 |
| 440 | /dev/sdb2 3.0G 3.0G 20K 100% /mnt/sdb2 |
| 441 | }}} |
| 442 | * sha1sum -b /mnt/sdb*/rand* > checksum.sha1 |
| 443 | 1. remake partition |
| 444 | * sudo umount /dev/sdb![123] |
| 445 | * sudo fdisk /dev/sdb |
| 446 | {{{ |
| 447 | Command (m for help): d |
| 448 | Partition number (1-4): 1 |
| 449 | |
| 450 | Command (m for help): d |
| 451 | Selected partition 2 |
| 452 | |
| 453 | Command (m for help): n |
| 454 | Command action |
| 455 | e extended |
| 456 | p primary partition (1-4) |
| 457 | p |
| 458 | Partition number (1-4): 1 |
| 459 | First cylinder (1-522, default 1): |
| 460 | Using default value 1 |
| 461 | Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522): |
| 462 | Using default value 522 |
| 463 | |
| 464 | /dev/sdb1 1 522 4192933+ 83 Linux |
| 465 | }}} |
| 466 | * sudo mount /dev/sdb1 /mnt/sdb1 |
| 467 | * sha1sum -c checksum.sha1 |
| 468 | {{{ |
| 469 | /mnt/sdb1/rand1.10M: OK |
| 470 | /mnt/sdb1/rand1.900M: OK |
| 471 | /mnt/sdb1/rand1.max: OK |
| 472 | sha1sum: /mnt/sdb2/rand2.10M: No such file or directory |
| 473 | /mnt/sdb2/rand2.10M: FAILED open or read |
| 474 | sha1sum: /mnt/sdb2/rand2.2900M: No such file or directory |
| 475 | /mnt/sdb2/rand2.2900M: FAILED open or read |
| 476 | sha1sum: /mnt/sdb2/rand2.max: No such file or directory |
| 477 | /mnt/sdb2/rand2.max: FAILED open or read |
| 478 | sha1sum: WARNING: 3 of 6 listed files could not be read |
| 479 | }}} |
| 480 | * 旧sdb1の内容がmountされる |
| 481 | 1. copy sdb2 to sdb1 with dd |
| 482 | * sudo umount /dev/sdb![123] |
| 483 | * sudo dd if=/dev/sdb of=/dev/sdb bs=512 count=6265350 seek=63 skip=2120580 & |
| 484 | {{{ |
| 485 | /dev/sdb1 63 2120579 1060258+ 83 Linux |
| 486 | /dev/sdb2 2120580 8385929 3132675 83 Linux |
| 487 | }}} |
| 488 | * seek=BLOCKS |
| 489 | * skip BLOCKS obs-sized blocks at start of output |
| 490 | * skip=BLOCKS |
| 491 | * skip BLOCKS ibs-sized blocks at start of input |
| 492 | * 6265350 = 8385929 - 2120580 + 1 |
| 493 | 1. re-mount |
| 494 | * sudo mount /dev/sdb1 /mnt/sdb2 |
| 495 | * df -h |
| 496 | {{{ |
| 497 | /dev/sdb1 3.0G 3.0G 20K 100% /mnt/sdb2 |
| 498 | }}} |
| 499 | 1. verify data |
| 500 | * sha1sum -c checksum.sha1 |
| 501 | {{{ |
| 502 | sha1sum: /mnt/sdb1/rand1.10M: No such file or directory |
| 503 | /mnt/sdb1/rand1.10M: FAILED open or read |
| 504 | sha1sum: /mnt/sdb1/rand1.900M: No such file or directory |
| 505 | /mnt/sdb1/rand1.900M: FAILED open or read |
| 506 | sha1sum: /mnt/sdb1/rand1.max: No such file or directory |
| 507 | /mnt/sdb1/rand1.max: FAILED open or read |
| 508 | /mnt/sdb2/rand2.10M: OK |
| 509 | /mnt/sdb2/rand2.2900M: OK |
| 510 | /mnt/sdb2/rand2.max: OK |
| 511 | sha1sum: WARNING: 3 of 6 listed files could not be read |
| 512 | }}} |
| 513 | * 問題なく旧sdb2の内容になっている |
| 514 | 1. resize xfs filesystem |
| 515 | * sudo xfs_growfs /mnt/sdb2 |
| 516 | {{{ |
| 517 | meta-data=/dev/sdb1 isize=256 agcount=6, agsize=131532 blks |
| 518 | = sectsz=512 attr=2 |
| 519 | data = bsize=4096 blocks=783168, imaxpct=25 |
| 520 | = sunit=0 swidth=0 blks |
| 521 | naming =version 2 bsize=4096 ascii-ci=0 |
| 522 | log =internal bsize=4096 blocks=2560, version=2 |
| 523 | = sectsz=512 sunit=0 blks, lazy-count=1 |
| 524 | realtime =none extsz=4096 blocks=0, rtextents=0 |
| 525 | data blocks changed from 783168 to 1048233 |
| 526 | }}} |
| 527 | * df -h |
| 528 | {{{ |
| 529 | /dev/sdb1 4.0G 3.0G 1.1G 75% /mnt/sdb2 |
| 530 | }}} |