六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 750|回复: 0

LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block wh...

[复制链接]
 楼主| 发表于 2018-1-8 23:28:54 | 显示全部楼层 |阅读模式
LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
  1. LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while) 2015-09-04 11:28:01



  2. 分类: Linux



  3. LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
  4. 给某个硬盘增加分区之后
  5. [root@Mysql01-213-66 ~]# df -h
  6. Filesystem                            Size  Used Avail Use% Mounted on
  7. /dev/mapper/vg_mysql0121366-LogVol02  7.7G  2.6G  4.8G  36% /
  8. tmpfs                                 495M     0  495M   0% /dev/shm
  9. /dev/sda1                             194M   29M  155M  16% /boot
  10. /dev/mapper/vg_mysql0121366-LogVol01  8.0G  3.1G  5.0G  38% /data
  11. 这里增加/data大小
  12. [root@Mysql01-213-66 ~]# fdisk -l /dev/sda

  13. Disk /dev/sda: 40.8 GB, 40802189312 bytes
  14. heads, 63 sectors/track, 4960 cylinders
  15. Units = cylinders of 16065 * 512 = 8225280 bytes
  16. Sector size (logical/physical): 512 bytes / 512 bytes
  17. I/O size (minimum/optimal): 512 bytes / 512 bytes
  18. Disk identifier: 0x000eb81f

  19.    Device Boot      Start         End      Blocks   Id  System
  20. /dev/sda1   *           1          26      204800   83  Linux
  21. Partition 1 does not end on cylinder boundary.
  22. /dev/sda2              26        2350    18668544   8e  Linux LVM

  23. 进行分区
  24. [root@Mysql01-213-66 ~]# fdisk /dev/sda

  25. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  26.          switch off the mode (command 'c') and change display units to
  27.          sectors (command 'u').

  28. Command (m for help): n
  29. Command action
  30.    e   extended
  31.    p   primary partition (1-4)
  32. p
  33. Partition number (1-4): 3
  34. First cylinder (2350-4960, default 2350):
  35. Using default value 2350
  36. Last cylinder, +cylinders or +size{K,M,G} (2350-4960, default 4960):
  37. Using default value 4960

  38. Command (m for help): p

  39. Disk /dev/sda: 40.8 GB, 40802189312 bytes
  40. heads, 63 sectors/track, 4960 cylinders
  41. Units = cylinders of 16065 * 512 = 8225280 bytes
  42. Sector size (logical/physical): 512 bytes / 512 bytes
  43. I/O size (minimum/optimal): 512 bytes / 512 bytes
  44. Disk identifier: 0x000eb81f

  45.    Device Boot      Start         End      Blocks   Id  System
  46. /dev/sda1   *           1          26      204800   83  Linux
  47. Partition 1 does not end on cylinder boundary.
  48. /dev/sda2              26        2350    18668544   8e  Linux LVM
  49. /dev/sda3            2350        4960    20966832   83  Linux

  50. Command (m for help): t
  51. Partition number (1-4): 3
  52. Hex code (type L to list codes): 8e
  53. Changed system type of partition 3 to 8e (Linux LVM)

  54. Command (m for help): w
  55. The partition table has been altered!

  56. Calling ioctl() to re-read partition table.

  57. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
  58. The kernel still uses the old table. The new table will be used at
  59. the next reboot or after you run partprobe(8) or kpartx(8)
  60. Syncing disks.

  61. 重启服务器或者 partprobe
  62. 创建物理卷
  63. [root@Mysql01-213-66 ~]# pvcreate /dev/sda3
  64.   Physical volume "/dev/sda3" successfully created
  65. 使用vgscan查询物理卷
  66. [root@Mysql01-213-66 ~]# vgscan
  67.   Reading all physical volumes.  This may take a while...
  68.   Found volume group "vg_mysql0121366" using metadata type lvm2
  69. 使用新增物理卷扩展vg
  70. [root@Mysql01-213-66 ~]# vgextend vg_mysql0121366 /dev/sda3
  71.   Volume group "vg_mysql0121366" successfully extended
  72. [root@Mysql01-213-66 ~]# vgscan
  73.   Reading all physical volumes.  This may take a while...
  74.   Found volume group "vg_mysql0121366" using metadata type lvm2
  75.   查询vg
  76. [root@Mysql01-213-66 ~]# vgdisplay
  77.   --- Volume group ---
  78.   VG Name               vg_mysql0121366
  79.   System ID            
  80.   Format                lvm2
  81.   Metadata Areas        2
  82.   Metadata Sequence No  5
  83.   VG Access             read/write
  84.   VG Status             resizable
  85.   MAX LV                0
  86.   Cur LV                3
  87.   Open LV               3
  88.   Max PV                0
  89.   Cur PV                2
  90.   Act PV                2
  91.   VG Size               37.79 GiB
  92.   PE Size               4.00 MiB
  93.   Total PE              9675
  94.   Alloc PE / Size       4557 / 17.80 GiB
  95.   Free  PE / Size       5118 / 19.99 GiB
  96.   VG UUID               Zy2PVv-xSsx-NEAv-L6ba-G8Oy-tBBq-5zXKQm
  97. 查询lv
  98. [root@Mysql01-213-66 ~]# lvdisplay
  99.   --- Logical volume ---
  100.   LV Path                /dev/vg_mysql0121366/LogVol01
  101.   LV Name                LogVol01
  102.   VG Name                vg_mysql0121366
  103.   LV UUID                5znkJ2-wdeZ-Y2o1-ECDS-gzzl-PqaS-qo2yZR
  104.   LV Write Access        read/write
  105.   LV Creation host, time Mysql01-213-66, 2015-08-30 20:42:13 +0800
  106.   LV Status              available
  107.   # open                 1
  108.   LV Size                8.00 GiB
  109.   Current LE             2048
  110.   Segments               1
  111.   Allocation             inherit
  112.   Read ahead sectors     auto
  113.   - currently set to     256
  114.   Block device           253:2
  115.    
  116.   --- Logical volume ---
  117.   LV Path                /dev/vg_mysql0121366/LogVol00
  118.   LV Name                LogVol00
  119.   VG Name                vg_mysql0121366
  120.   LV UUID                b1FV1n-iKyK-kZ23-glRO-opFh-gDRp-TzWNcL
  121.   LV Write Access        read/write
  122.   LV Creation host, time Mysql01-213-66, 2015-08-30 20:42:14 +0800
  123.   LV Status              available
  124.   # open                 1
  125.   LV Size                2.00 GiB
  126.   Current LE             512
  127.   Segments               1
  128.   Allocation             inherit
  129.   Read ahead sectors     auto
  130.   - currently set to     256
  131.   Block device           253:0
  132.    
  133.   --- Logical volume ---
  134.   LV Path                /dev/vg_mysql0121366/LogVol02
  135.   LV Name                LogVol02
  136.   VG Name                vg_mysql0121366
  137.   LV UUID                eoVdk3-cbcP-9PlI-kZBL-6pY2-Jpbl-1WI2uH
  138.   LV Write Access        read/write
  139.   LV Creation host, time Mysql01-213-66, 2015-08-30 20:42:14 +0800
  140.   LV Status              available
  141.   # open                 1
  142.   LV Size                7.80 GiB
  143.   Current LE             1997
  144.   Segments               1
  145.   Allocation             inherit
  146.   Read ahead sectors     auto
  147.   - currently set to     256
  148.   Block device           253:1
  149.    
  150. [root@Mysql01-213-66 ~]# df -h
  151. Filesystem                            Size  Used Avail Use% Mounted on
  152. /dev/mapper/vg_mysql0121366-LogVol02  7.7G  2.6G  4.8G  35% /
  153. tmpfs                                 495M     0  495M   0% /dev/shm
  154. /dev/sda1                             194M   29M  155M  16% /boot
  155. /dev/mapper/vg_mysql0121366-LogVol01  8.0G  3.1G  5.0G  38% /data
  156. 扩展lv
  157. [root@Mysql01-213-66 ~]# lvextend -L +19G /dev/mapper/vg_mysql0121366-LogVol01
  158.   Extending logical volume LogVol01 to 27.00 GiB
  159.   Logical volume LogVol01 successfully resized
  160. [root@Mysql01-213-66 ~]# df -h
  161. Filesystem                            Size  Used Avail Use% Mounted on
  162. /dev/mapper/vg_mysql0121366-LogVol02  7.7G  2.6G  4.8G  35% /
  163. tmpfs                                 495M     0  495M   0% /dev/shm
  164. /dev/sda1                             194M   29M  155M  16% /boot
  165. /dev/mapper/vg_mysql0121366-LogVol01  8.0G  3.1G  5.0G  38% /data
  166. 若不是xfs我们可以用resize2fs,这里报错了
  167. [root@Mysql01-213-66 ~]# resize2fs -f /dev/mapper/vg_mysql0121366-LogVol01
  168. resize2fs 1.41.12 (17-May-2010)
  169. resize2fs: Bad magic number in super-block while trying to open /dev/mapper/vg_mysql0121366-LogVol01
  170. Couldn't find valid filesystem superblock.
  171. [root@Mysql01-213-66 ~]# xfs_growfs /dev/mapper/vg_mysql0121366-LogVol01
  172. meta-data=/dev/mapper/vg_mysql0121366-LogVol01 isize=256    agcount=4, agsize=524288 blks
  173.          =                       sectsz=512   attr=2, projid32bit=0
  174. data     =                       bsize=4096   blocks=2097152, imaxpct=25
  175.          =                       sunit=0      swidth=0 blks
  176. naming   =version 2              bsize=4096   ascii-ci=0
  177. log      =internal               bsize=4096   blocks=2560, version=2
  178.          =                       sectsz=512   sunit=0 blks, lazy-count=1
  179. realtime =none                   extsz=4096   blocks=0, rtextents=0
  180. data blocks changed from 2097152 to 7077888
  181. [root@Mysql01-213-66 ~]# df -h
  182. Filesystem                            Size  Used Avail Use% Mounted on
  183. /dev/mapper/vg_mysql0121366-LogVol02  7.7G  2.6G  4.8G  35% /
  184. tmpfs                                 495M     0  495M   0% /dev/shm
  185. /dev/sda1                             194M   29M  155M  16% /boot
  186. /dev/mapper/vg_mysql0121366-LogVol01   27G  3.1G   24G  12% /data
复制代码
LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表