Ask Your Question

Doubts about nova and swap files

asked 2015-06-17 12:23:46 -0500

rarylson gravatar image

updated 2015-06-17 15:02:53 -0500

I have some doubts about the qcow2 swap files created by nova when launching instances.

I've launched two instances with respectively 1G and 8G of swap memory. So, I verified that four disks where created in the _bare dir:

$ ls -lh _base/swap*
-rw-r--r-- 1 libvirt-qemu kvm  1.0G Jun 16 18:18 swap_1024
-rw-r--r-- 2 nova         nova 1.0T Jun 16 18:18 swap_1024_1024
-rw-r--r-- 1 libvirt-qemu kvm  8.0G Jun 16 18:18 swap_8192
-rw-r--r-- 2 nova         nova 8.0T Jun 16 18:18 swap_8192_8192
$ du -h _base/swap*
4.0K    swap_1024
4.0K    swap_1024_1024
4.0K    swap_8192
4.0K    swap_8192_8192

And that two disk.swap files where created each one inside the instance dir:

$ ls -lh */disk.swap
-rw-r--r-- 1 libvirt-qemu kvm  246M Jun 17 13:18 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
-rw-r--r-- 1 libvirt-qemu kvm  2.3M Jun 12 23:54 f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
$ du -h */disk.swap
246M    7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
2.2M    f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
$ qemu-img info 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
image: 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 245M
backing file: /var/nova-data/instances/_base/swap_1024
$ qemu-img info f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
image: f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 2.2M
backing file: /var/nova-data/instances/_base/swap_8192

So, I have the following doubts:

  • Why were the swap_1024 and swap_8192 files created as the qcow2 backing file of the disk.swap files?
    • Using qcow2 disks and CoW (copy-on-write) doesn't save space. It really seems that the CoW method for swap files doesn't give us any real advantage;
    • I have similar questions about ephemeral disks (is it necessary to use CoW?);
  • Why were the swap_1024_1024 and swap_8192_8192 created?
    • It makes any sense to create a 1T and 8T qcow2 files? Are they used in any moment by nova-compute?
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-02-05 07:45:42 -0500


I'm having the same problem, how did you solve this? swap_1024_1024 being created as backing swap file twice

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-06-17 12:23:46 -0500

Seen: 626 times

Last updated: Jun 17 '15