Skip to content

Instantly share code, notes, and snippets.

@miabbott
Created June 4, 2015 15:51
Show Gist options
  • Select an option

  • Save miabbott/1fa4aa109c0b77a15818 to your computer and use it in GitHub Desktop.

Select an option

Save miabbott/1fa4aa109c0b77a15818 to your computer and use it in GitHub Desktop.
Adding storage to RHELAH non-desctructively
1. Create new file based disk. This creates a 10G sparsely allocated disk.
$ sudo dd if=/dev/zero of=/var/lib/libvirt/images/rhelah_7.1.2_extra.img bs=1M seek=10240 count=0
2. Create a KVM disk config
$ cat rhelah_7.1.2_extra.xml
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/rhelah_7.1.2_extra.img'/>
<target dev='vdb'/>
</disk>
3. Attach the disk to the VM
$ sudo virsh attach-device --config rhel-atomic-7.1.2 rhelah_7.1.2_extra.xml
4. Verify the disk is attached. Inspect the XML for the new disk section.
$ sudo virsh dumpxml rhel-atomic-7.1.2
5. Start your VM
$ sudo virsh start rhel-atomic-7.1.2
6. Login to the VM and stop 'docker' and 'docker-storage-setup'
# systemctl stop docker docker-storage-setup
7. Create new PV from disk
# pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created
8. Extend the 'atomicos' VG
# vgextend atomicos /dev/vdb
Volume group "atomicos" successfully extended
9. Extend the 'root' LV
# lvextend -L +3GB /dev/atomicos/root
Size of logical volume atomicos/root changed from 2.94 GiB (94 extents) to 5.94 GiB (190 extents).
Logical volume root successfully resized
10. Grow the XFS filesystem
# xfs_growfs /
meta-data=/dev/mapper/atomicos-root isize=256 agcount=4, agsize=192512 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=770048, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 770048 to 1556480
11. Start 'docker' and 'docker-storage-setup'
# systemctl start docker docker-storage-setup
12. Inspect 'docker-storage-setup' logs for results
# journalctl -u docker-storage-setup
...
Jun 04 15:32:46 rhel-atomic-test-0.localdomain docker-storage-setup[5604]: Physical volume "/dev/vdb" changed
Jun 04 15:32:46 rhel-atomic-test-0.localdomain docker-storage-setup[5604]: 1 physical volume(s) resized / 0 physical volume(s) not resized
Jun 04 15:32:46 rhel-atomic-test-0.localdomain docker-storage-setup[5604]: Size of logical volume atomicos/docker-pool_tdata changed from 6.69 GiB (214 extents) to 13.53 GiB (433 extents).
Jun 04 15:32:46 rhel-atomic-test-0.localdomain docker-storage-setup[5604]: Logical volume docker-pool successfully resized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment