Advertisement
Guest User

Untitled

a guest
May 26th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. yum install parted -y
  2. parted /dev/sda
  3.  
  4. (parted) unit MB print free
  5. Model: QEMU QEMU HARDDISK (scsi)
  6. Disk /dev/sda: 53687MB
  7. Sector size (logical/physical): 512B/512B
  8. Partition Table: msdos
  9.  
  10. Number Start End Size Type File system Flags
  11. 0.03MB 1.05MB 1.02MB Free Space
  12. 1 1.05MB 525MB 524MB primary ext4 boot
  13. 2 525MB 10737MB 10212MB primary lvm
  14. 10737MB 53687MB 42950MB Free Space
  15.  
  16. mkpart primary ext4 10737 53687
  17. quit
  18. reboot
  19.  
  20.  
  21.  
  22. [root@ip179 ~]# parted /dev/sda
  23. GNU Parted 2.1
  24. Using /dev/sda
  25. Welcome to GNU Parted! Type 'help' to view a list of commands.
  26. (parted) print
  27. Model: QEMU QEMU HARDDISK (scsi)
  28. Disk /dev/sda: 53.7GB
  29. Sector size (logical/physical): 512B/512B
  30. Partition Table: msdos
  31.  
  32. Number Start End Size Type File system Flags
  33. 1 1049kB 525MB 524MB primary ext4 boot
  34. 2 525MB 10.7GB 10.2GB primary lvm
  35. 3 10.7GB 53.7GB 42.9GB primary
  36.  
  37. (parted) ^C
  38. (parted) quit
  39. [root@ip179 ~]# pvcreate /dev/sda3
  40. Physical volume "/dev/sda3" successfully created
  41. [root@ip179 ~]# vgextend VolGroup /dev/sda3
  42. Volume group "VolGroup" successfully extended
  43. [root@ip179 ~]# ^C
  44. [root@ip179 ~]# df -h
  45. Filesystem Size Used Avail Use% Mounted on
  46. /dev/mapper/VolGroup-lv_root
  47. 8.3G 842M 7.1G 11% /
  48. tmpfs 498M 0 498M 0% /dev/shm
  49. /dev/sda1 477M 52M 400M 12% /boot
  50. [root@ip179 ~]# vgdisplay
  51. --- Volume group ---
  52. VG Name VolGroup
  53. System ID
  54. Format lvm2
  55. Metadata Areas 2
  56. Metadata Sequence No 4
  57. VG Access read/write
  58. VG Status resizable
  59. MAX LV 0
  60. Cur LV 2
  61. Open LV 2
  62. Max PV 0
  63. Cur PV 2
  64. Act PV 2
  65. VG Size 49.50 GiB
  66. PE Size 4.00 MiB
  67. Total PE 12673
  68. Alloc PE / Size 2434 / 9.51 GiB
  69. Free PE / Size 10239 / 40.00 GiB
  70. VG UUID tp0a2o-Hkup-3V0m-01K1-udfY-Y2l2-gTMHjg
  71.  
  72. [root@ip179 ~]# resize2fs /dev/VolGroup/lv_root
  73. resize2fs 1.41.12 (17-May-2010)
  74. The filesystem is already 2238464 blocks long. Nothing to do!
  75.  
  76. [root@ip179 ~]# lvextend /dev/VolGroup/lv_root /dev/sda3
  77. Size of logical volume VolGroup/lv_root changed from 8.54 GiB (2186 extents) to 48.54 GiB (12425 extents).
  78. Logical volume lv_root successfully resized.
  79. [root@ip179 ~]# df -h
  80. Filesystem Size Used Avail Use% Mounted on
  81. /dev/mapper/VolGroup-lv_root
  82. 8.3G 842M 7.1G 11% /
  83. tmpfs 498M 0 498M 0% /dev/shm
  84. /dev/sda1 477M 52M 400M 12% /boot
  85. [root@ip179 ~]# lvresize --extents +100%FREE --resizefs /dev/VolGroup/lv_root
  86. [root@ip179 ~]# df -h
  87. Filesystem Size Used Avail Use% Mounted on
  88. /dev/mapper/VolGroup-lv_root
  89. 8.3G 842M 7.1G 11% /
  90. tmpfs 498M 0 498M 0% /dev/shm
  91. /dev/sda1 477M 52M 400M 12% /boot
  92. [root@ip179 ~]#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement