Advertisement
Dolapevich

Simulating a LUN resize and growin PV without reboot.

Apr 27th, 2015
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.78 KB | None | 0 0
  1. Estado antes de agregar el disco nuevo a md0.
  2. ---------------------------------------------
  3.  
  4. root@debian8:~# cat /proc/mdstat
  5. Personalities : [raid0]
  6. md0 : active raid0 sdc[1] sdb[0]
  7. 407552 blocks super 1.2 512k chunks
  8.  
  9. unused devices: <none>
  10. root@debian8:~# pvscan
  11. PV /dev/md0 VG vg lvm2 [396.00 MiB / 0 free]
  12. Total: 1 [396.00 MiB] / in use: 1 [396.00 MiB] / in no VG: 0 [0 ]
  13.  
  14.  
  15. root@debian8:~# pvdisplay -v
  16. DEGRADED MODE. Incomplete RAID LVs will be processed.
  17. Scanning for physical volume names
  18. --- Physical volume ---
  19. PV Name /dev/md0
  20. VG Name vg
  21. PV Size 398.00 MiB / not usable 2.00 MiB
  22. Allocatable yes (but full)
  23. PE Size 4.00 MiB
  24. Total PE 99
  25. Free PE 0
  26. Allocated PE 99
  27. PV UUID qHvVvr-V42v-Ig3R-qxgc-jB6g-OMZL-Dt0CPb
  28.  
  29.  
  30. root@debian8:~# vgdisplay -v
  31. DEGRADED MODE. Incomplete RAID LVs will be processed.
  32. Finding all volume groups
  33. Finding volume group "vg"
  34. --- Volume group ---
  35. VG Name vg
  36. System ID
  37. Format lvm2
  38. Metadata Areas 1
  39. Metadata Sequence No 2
  40. VG Access read/write
  41. VG Status resizable
  42. MAX LV 0
  43. Cur LV 1
  44. Open LV 1
  45. Max PV 0
  46. Cur PV 1
  47. Act PV 1
  48. VG Size 396.00 MiB
  49. PE Size 4.00 MiB
  50. Total PE 99
  51. Alloc PE / Size 99 / 396.00 MiB
  52. Free PE / Size 0 / 0
  53. VG UUID he13YU-jkD7-HFUV-4CHo-8z0v-dHwO-vcFPf7
  54.  
  55. --- Logical volume ---
  56. LV Path /dev/vg/test
  57. LV Name test
  58. VG Name vg
  59. LV UUID sactKM-UVIH-F3kx-tOJB-5Ee0-AsG8-ZHjiQX
  60. LV Write Access read/write
  61. LV Creation host, time debian8, 2015-04-27 20:13:45 -0300
  62. LV Status available
  63. # open 1
  64. LV Size 396.00 MiB
  65. Current LE 99
  66. Segments 1
  67. Allocation inherit
  68. Read ahead sectors auto
  69. - currently set to 4096
  70. Block device 253:0
  71.  
  72. --- Physical volumes ---
  73. PV Name /dev/md0
  74. PV UUID qHvVvr-V42v-Ig3R-qxgc-jB6g-OMZL-Dt0CPb
  75. PV Status allocatable
  76. Total PE / Free PE 99 / 0
  77.  
  78. root@debian8:~# df -h /sarasa/
  79. Filesystem Size Used Avail Use% Mounted on
  80. /dev/mapper/vg-test 376M 2.3M 350M 1% /sarasa
  81. root@debian8:~# fuser -m /sarasa/
  82. /sarasa: 796c 832c 1023c 1064c 9111c
  83.  
  84.  
  85.  
  86. Acรก me vine a enterar que raid0 no sopota crecer.
  87. Por suerte lo pude convertir a raid4.
  88. -------------------------------------------------
  89. root@debian8:~# mdadm --misc -Q --detail /dev/md0
  90. /dev/md0:
  91. Version : 1.2
  92. Creation Time : Mon Apr 27 20:01:03 2015
  93. Raid Level : raid0
  94. Array Size : 407552 (398.07 MiB 417.33 MB)
  95. Raid Devices : 2
  96. Total Devices : 2
  97. Persistence : Superblock is persistent
  98.  
  99. Update Time : Mon Apr 27 20:01:03 2015
  100. State : clean
  101. Active Devices : 2
  102. Working Devices : 2
  103. Failed Devices : 0
  104. Spare Devices : 0
  105.  
  106. Chunk Size : 512K
  107.  
  108. Name : debian8:0 (local to host debian8)
  109. UUID : f6b546b8:1b429508:5614ff20:5cef87c5
  110. Events : 0
  111.  
  112. Number Major Minor RaidDevice State
  113. 0 8 16 0 active sync /dev/sdb
  114. 1 8 32 1 active sync /dev/sdc
  115.  
  116.  
  117. root@debian8:~# mdadm --grow /dev/md0 --level=0 --raid-devices=3 --add /dev/sda
  118. mdadm: level of /dev/md0 changed to raid4
  119. mdadm: added /dev/sda
  120. mdadm: Need to backup 3072K of critical section..
  121.  
  122.  
  123. root@debian8:~# mdadm --misc -Q --detail /dev/md0
  124. /dev/md0:
  125. Version : 1.2
  126. Creation Time : Mon Apr 27 20:01:03 2015
  127. Raid Level : raid4
  128. Array Size : 611328 (597.10 MiB 626.00 MB)
  129. Used Dev Size : 203776 (199.03 MiB 208.67 MB)
  130. Raid Devices : 4
  131. Total Devices : 3
  132. Persistence : Superblock is persistent
  133.  
  134. Update Time : Mon Apr 27 20:41:31 2015
  135. State : clean, degraded
  136. Active Devices : 3
  137. Working Devices : 3
  138. Failed Devices : 0
  139. Spare Devices : 0
  140.  
  141. Chunk Size : 512K
  142.  
  143. Name : debian8:0 (local to host debian8)
  144. UUID : f6b546b8:1b429508:5614ff20:5cef87c5
  145. Events : 48
  146.  
  147. Number Major Minor RaidDevice State
  148. 0 8 16 0 active sync /dev/sdb
  149. 1 8 32 1 active sync /dev/sdc
  150. 3 8 0 2 active sync /dev/sda
  151. 6 0 0 6 removed
  152.  
  153.  
  154. Acรก crezco todo.
  155. -----------------------------------------------------------------
  156.  
  157. root@debian8:~# pvresize /dev/md0
  158. Physical volume "/dev/md0" changed
  159. 1 physical volume(s) resized / 0 physical volume(s) not resized
  160.  
  161. root@debian8:~# pvdisplay -v
  162. DEGRADED MODE. Incomplete RAID LVs will be processed.
  163. Scanning for physical volume names
  164. --- Physical volume ---
  165. PV Name /dev/md0
  166. VG Name vg
  167. PV Size 597.00 MiB / not usable 1.00 MiB
  168. Allocatable yes
  169. PE Size 4.00 MiB
  170. Total PE 149
  171. Free PE 50
  172. Allocated PE 99
  173. PV UUID qHvVvr-V42v-Ig3R-qxgc-jB6g-OMZL-Dt0CPb
  174.  
  175. root@debian8:~# vgdisplay
  176. --- Volume group ---
  177. VG Name vg
  178. System ID
  179. Format lvm2
  180. Metadata Areas 1
  181. Metadata Sequence No 3
  182. VG Access read/write
  183. VG Status resizable
  184. MAX LV 0
  185. Cur LV 1
  186. Open LV 1
  187. Max PV 0
  188. Cur PV 1
  189. Act PV 1
  190. VG Size 596.00 MiB
  191. PE Size 4.00 MiB
  192. Total PE 149
  193. Alloc PE / Size 99 / 396.00 MiB
  194. Free PE / Size 50 / 200.00 MiB
  195. VG UUID he13YU-jkD7-HFUV-4CHo-8z0v-dHwO-vcFPf7
  196.  
  197.  
  198. root@debian8:~# df -h /sarasa/
  199. Filesystem Size Used Avail Use% Mounted on
  200. /dev/mapper/vg-test 376M 2.3M 350M 1% /sarasa
  201. root@debian8:~# fuser -m /sarasa/
  202. /sarasa: 796c 832c 1023c 1064c 9111c
  203.  
  204. root@debian8:~# lvextend -v -r -l+50 /dev/mapper/vg-test
  205. DEGRADED MODE. Incomplete RAID LVs will be processed.
  206. Finding volume group vg
  207. Executing: fsadm --verbose check /dev/vg/test
  208. fsadm: "ext4" filesystem found on "/dev/mapper/vg-test"
  209. fsadm: Skipping filesystem check for device "/dev/mapper/vg-test" as the filesystem is mounted on /sarasa
  210. fsadm failed: 3
  211. Archiving volume group "vg" metadata (seqno 3).
  212. Extending logical volume vg/test to 596.00 MiB
  213. Size of logical volume vg/test changed from 396.00 MiB (99 extents) to 596.00 MiB (149 extents).
  214. Loading vg-test table (253:0)
  215. Suspending vg-test (253:0) with device flush
  216. Resuming vg-test (253:0)
  217. Creating volume group backup "/etc/lvm/backup/vg" (seqno 4).
  218. Logical volume test successfully resized
  219. Executing: fsadm --verbose resize /dev/vg/test 610304K
  220. fsadm: "ext4" filesystem found on "/dev/mapper/vg-test"
  221. fsadm: Device "/dev/mapper/vg-test" size is 624951296 bytes
  222. fsadm: Parsing tune2fs -l "/dev/mapper/vg-test"
  223. fsadm: Resizing filesystem on device "/dev/mapper/vg-test" to 624951296 bytes (405504 -> 610304 blocks of 1024 bytes)
  224. fsadm: Executing resize2fs /dev/mapper/vg-test 610304
  225. resize2fs 1.42.12 (29-Aug-2014)
  226. Filesystem at /dev/mapper/vg-test is mounted on /sarasa; on-line resizing required
  227. old_desc_blocks = 2, new_desc_blocks = 3
  228. The filesystem on /dev/mapper/vg-test is now 610304 (1k) blocks long.
  229.  
  230. root@debian8:~# df -h /sarasa/
  231. Filesystem Size Used Avail Use% Mounted on
  232. /dev/mapper/vg-test 570M 2.3M 536M 1% /sarasa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement