Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. LVM2 partition previously began on sector 2048
  2.  
  3. Offset 1048576 = 2048 * 512
  4.  
  5. dmsetup table shows where LV begins, usually at offset 2048 (unit=sectors), -> new partition starts at sector 4096!
  6.  
  7. Don't forget to update-grub (check root=UUID=<uuid of ext4>) and grub-install /dev/vda after making these changes!
  8.  
  9. # fdisk -l
  10. Disk /dev/vda: 32 GiB, 34359738368 bytes, 67108864 sectors
  11. Units: sectors of 1 * 512 = 512 bytes
  12. Sector size (logical/physical): 512 bytes / 512 bytes
  13. I/O size (minimum/optimal): 512 bytes / 512 bytes
  14. Disklabel type: dos
  15. Disk identifier: 0x5b446ef5
  16.  
  17. Device Boot Start End Sectors Size Id Type
  18. /dev/vda1 4096 67108863 67104768 32G 83 Linux
  19.  
  20. # Overwrite LVM2 header
  21.  
  22. # hexdump -C /dev/vda -s 1048576 -n 2048
  23. 00100000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  24. *
  25. 00100200 4c 41 42 45 4c 4f 4e 45 01 00 00 00 00 00 00 00 |LABELONE........|
  26. 00100210 37 d8 9c 27 20 00 00 00 4c 56 4d 32 20 30 30 31 |7..' ...LVM2 001|
  27. 00100220 4a 32 55 32 6e 4e 59 31 6f 4c 50 76 69 6a 48 46 |J2U2nNY1oLPvijHF|
  28. 00100230 42 54 6b 52 42 76 33 4f 73 58 6e 37 32 4f 51 46 |BTkRBv3OsXn72OQF|
  29. 00100240 00 00 f0 ff 07 00 00 00 00 00 10 00 00 00 00 00 |................|
  30. 00100250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  31. 00100260 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 |................|
  32. 00100270 00 f0 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  33. 00100280 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
  34. 00100290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  35. *
  36. 00100800
  37.  
  38. # dd if=/dev/zero of=/dev/vda seek=1048576 bs=1 count=1024 conv=notrunc 1024+0 records in
  39. 1024+0 records out
  40. 1024 bytes (1.0 kB) copied, 0.00233243 s, 439 kB/s
  41. root@playground ~ # hexdump -C /dev/vda -s 1048576 -n 2048
  42. 00100000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  43. *
  44. 00100800
  45.  
  46. # resize2fs /dev/vda1
  47. resize2fs 1.42.12 (29-Aug-2014)
  48. Filesystem at /dev/vda1 is mounted on /; on-line resizing required
  49. old_desc_blocks = 1, new_desc_blocks = 2
  50. The filesystem on /dev/vda1 is now 8388096 (4k) blocks long.
  51.  
  52. root@playground ~ # df
  53. Filesystem 1K-blocks Used Available Use% Mounted on
  54. /dev/vda1 32894832 1070876 30381616 4% /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement