Description of problem:
Sometimes the waagent mount the local disk partition (/dev/sdb1) before it exists, so that the mount is failed.
The error code of "mount: special device /dev/sdd1 does not exist" is 32, which is the same as "mount: /dev/sdb1 is already mounted" error code. As a result, the waagent regards the "device does not exist" as "already mounted" and create swap file directly even if the /dev/sdb1 is not mounted.
Version-Release number of selected component (if applicable):
WALinuxAgent-2.2.4-1
RHEL Version:
RHEL-7.3 on-demand image
kernel: 3.10.0-514.6.2.el7.x86_64
How reproducible:
30%
Steps to Reproduce:
1. Prepare a RHEL-7.3 VM(Standard_A1) with WALA-2.2.4-1 installed and enabled. Set "ResourceDisk.EnableSwap=y"
2. Reboot the VM.
3. After the VM is booted, check the swap and the mount status:
free -m
mount
Actual Result:
The swap size is 0. The local disk partition is not mounted.
Expect Result:
The local disk partition is mounted.
/var/log/waagent.log:
2017/03/02 11:40:45.629813 INFO Activate resource disk
2017/03/02 11:40:45.666904 INFO Examining partition table
2017/03/02 11:40:45.722347 INFO GPT not detected, determining filesystem
2017/03/02 11:40:45.749369 INFO sfdisk with --part-type failed [1], retrying with -c
2017/03/02 11:40:45.778195 INFO sfdisk -c -f /dev/sdb 1 succeeded
2017/03/02 11:40:45.778361 INFO The partition type is 83
2017/03/02 11:40:45.778469 INFO Mount resource disk [mount /dev/sdb1 /mnt/resource]
2017/03/02 11:40:45.808002 WARNING Resource disk is already mounted: mount: special device /dev/sdb1 does not exist
2017/03/02 11:40:45.808140 INFO Resource disk /dev/sdb is mounted at /mnt/resource with ext4
2017/03/02 11:40:45.810434 INFO Enable swap
2017/03/02 11:40:45.869825 INFO Create swap file
2017/03/02 11:40:46.141439 ERROR run cmd 'swapon /mnt/resource/swapfile' failed
2017/03/02 11:40:46.142272 ERROR Error Code:255
2017/03/02 11:40:46.142349 ERROR Result:swapon: /mnt/resource/swapfile: swapon failed: Invalid argument
2017/03/02 11:40:46.142457 ERROR Failed to enable swap (000005)/mnt/resource/swapfile
Additional Info:
1. I've rebooted 100 times on RHEL-7.3 and this issue occurs 30 times. I also tried 100 times on RHEL-6.9 and it is not observed.
2. It seems that only small size VM(like A1, A2, D1_v2) have this issue. In the large size(D5_v2) it isn't observed.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHEA-2017:1321