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