我对resize2fs有一个奇怪的问题.我已经执行了所有命令并且它们都已成功,但是,我的文件系统与之前的大小相同:
[oracle@server~]$df -h /backup Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg2-lv_backup 985G 973G 2.4G 100% /backup [root@server~]# pvcreate /dev/cciss/c0d4p1 Physical volume "/dev/cciss/c0d4p1" successfully created [root@server~]# lvdisplay /dev/mapper/vg2-lv_backup | awk '/VG Name/{print $3}' vg2 [root@server~]# vgextend vg2 /dev/cciss/c0d4p1 Volume group "vg2" successfully extended [root@server~]# vgdisplay vg2 | awk '/Free *PE /{print $5}' 200 [root@server~]# lvextend -l +200 /dev/vg2/lv_backup Extending logical volume lv_backup to 1000.78 GB Logical volume lv_backup successfully resized [root@server~]# e2fsck -Cfp /dev/vg2/lv_backup e2fsck 1.39 (29-May-2006) backups: clean,1488/131072000 files,258919596/262144000 blocks [root@server~]# e2fsck -f /dev/mapper/vg2-lv_backup e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes,blocks,and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information backups: 1488/131072000 files (20.1% non-contiguous),258919596/262144000 blocks [root@server~]# resize2fs /dev/mapper/vg2-lv_backup resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/mapper/vg2-lv_backup to 262348800 (4k) blocks. The filesystem on /dev/mapper/vg2-lv_backup is now 262348800 blocks long.
问题是初始文件系统是1TB(几乎),而新的文件系统是800GB,所以新的逻辑卷现在应该是1.8TB左右.从这里,您可以看到两个驱动器都是相同卷组的一部分:
[root@server~]# pvs -v | grep vg2 Scanning for physical volume names /dev/cciss/c0d0p1 vg2 lvm2 a- 1000.00G 0 1000.00G 4cjtXN-uQ60-5ZvU-dih7-m0Lw-5IQy-RYxmOb /dev/cciss/c0d4p1 vg2 lvm2 a- 800.00M 0 800.84M X2f4CR-QI7M-XO5g-TQVh-e3sa-ebu8-MxaqXY
但是,它没有反映出来:
[root@server~]# lvs -v | grep vg2 Finding all logical volumes lv_backup vg2 2 -wi-a- 1000.78G -1 -1 253 73 IDEeg7-USRJ-OZLd-fC5t-kCxi-leHq-zfwoNF
有什么建议?
解决方法
您执行的lvextend命令只会将文件系统扩展800MB(假设默认扩展区大小),当您查看TB文件系统时会出现舍入错误. -l标志表示“范围”,默认情况下,其大小为4MB.如果你希望增加200GB的文件系统,命令将是:lvextend -L 200G vg2 / lv_backup. (注意-l和-L之间的区别.)
The problem is that the initial filesystem was 1TB (almost) and the new one is 800GB,so the new logical volume should now be around 1.8TB. From here,you can see that both the drives are part of the same volume groups:
初始文件系统是1TB.新磁盘为800GB.您将该磁盘添加到VG,然后使用800MB的磁盘来扩展LV,然后在LV上增加文件系统,在LV中保留1.0008TB.然后你增加了文件系统来填充LV.
如果您想最终使用1.8TB文件系统,请执行以下操作:
lvextend -L +800G vg2/lv_backup
要么:
lvextend -l 100%FREE vg2/lv_backup
接下来是resize2fs命令.