それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

LVMを使ってファイルシステムをリサイズする

LVMを使っているので,容量の拡大縮小が結構楽に行える

容量の拡大

  1. lvresize
  2. ext2online

容量の縮小

  1. resize2fs
  2. lvresize

実際容量減らしてみた

[root@web2 dtvadm]# lvresize -L -20GB /dev/VolGroup00/LogVol02
  WARNING: Reducing active and open logical volume to 225.25 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol02? [y/n]: y
  Reducing logical volume LogVol02 to 225.25 GB
  Logical volume LogVol02 successfully resized

って焦ってresize2fsするの忘れた.。。

ボリュームリサイズの順番を間違う

the physical size of the device is blocks either the superblock or the partition table is likely to be corrupt

落ちついて対処する

現在の状況を確認する

[root@web2 dtvadm]# lvscan
  ACTIVE            '/dev/VolGroup00/LogVol00' [10.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol02' [265.25 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [4.00 GB] inheri
resize2fs /dev/VolGroup00/LogVol02 245.25GB

ボリュームが元のサイズに戻るまで,落ち着いて、lvresizeで元に戻す

[root@web2 dtvadm]# lvresize -L +20GB /dev/VolGroup00/LogVol02


よかった元通り,焦りました.

一応年のため、失敗した状態や変更前をddしたりすればいいと思う.

落ち着いて処理するまでに1週間くらいかかったんですけどね

参考資料

you run the fsck command with the sudden fear of losing the precious data:

“The filesystem size (according to the superblock) is xxx

The physical size of the device is xxx

Either the superblock or the partition table is likely to be corrupt!”

The superblock is the important data structure of Linux file systems which describes the size of the inode-table and the size of the total file system. This also contains the information like File system type, size, status, information about the metadata structures. Thus this shows that the loss of either information may create serious problems of data loss in Linux.

The problem could be if some files have been attempted to write upon the portion of the disk where the superblock is stored and the filesystem wouldn’t allow it to write. The solution of the problem runs in three steps:

1. Unmount all the partitions using the ‘unmount-a’ command in single user mode
2. Repair the partitions
3. Resize the partitions
Resizing the partitions without repairing them may complicate the problem with the following error message:

“attempt to read block from filesystem resulted in short read while trying to resize”

http://l-w-i.net/t/fedora/lvm_003.txt

http://www.ubuntuhq.com/content/linux-error-039either-superblock-or-partition-table-likely-be-corrupt039
https://mail.google.com/mail/u/1/?ui=2&ik=47ecba2816&view=att&th=131bd1c3d3fad8fb&attid=0.1&disp=inline&realattid=1376924715841486848-1&zw