{"action":"created","issue":{"url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/92","repository_url":"https://api.github.com/repos/cloudfoundry/bosh-agent","labels_url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/92/comments","events_url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/92/events","html_url":"https://github.com/cloudfoundry/bosh-agent/issues/92","id":174690802,"number":92,"title":"bosh agent rewrites partition mistakenly during VM reboot","user":{"login":"mattcui","id":3347572,"avatar_url":"https://avatars.githubusercontent.com/u/3347572?v=3","gravatar_id":"","url":"https://api.github.com/users/mattcui","html_url":"https://github.com/mattcui","followers_url":"https://api.github.com/users/mattcui/followers","following_url":"https://api.github.com/users/mattcui/following{/other_user}","gists_url":"https://api.github.com/users/mattcui/gists{/gist_id}","starred_url":"https://api.github.com/users/mattcui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattcui/subscriptions","organizations_url":"https://api.github.com/users/mattcui/orgs","repos_url":"https://api.github.com/users/mattcui/repos","events_url":"https://api.github.com/users/mattcui/events{/privacy}","received_events_url":"https://api.github.com/users/mattcui/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cloudfoundry/bosh-agent/labels/problem","name":"problem","color":"d93f0b"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-02T06:38:28Z","updated_at":"2016-10-19T00:46:20Z","closed_at":null,"body":"We found bosh agent always rewrites the partition table every time when the VM is rebooted even if the disk is already partitioned and formatted. In the part of code of determining if needing to do partition, there is a problem where to get the device size at the line of  [`size, err := p.GetDeviceSizeInBytes(partitionPath)`](https://github.com/cloudfoundry/bosh-agent/blob/master/platform/disk/sfdisk_partitioner.go#L181)\r\n\r\nThere will return the following error when running this line:\r\n\r\n```\r\n2016-08-31_10:01:11.18516 [Cmd Runner] 2016/08/31 10:01:11 DEBUG - Running command 'sfdisk -s /dev/mapper/3600a09803830357a392448666a38304f1'\r\n2016-08-31_10:01:11.18813 [Cmd Runner] 2016/08/31 10:01:11 DEBUG - Stdout:\r\n2016-08-31_10:01:11.18814 [Cmd Runner] 2016/08/31 10:01:11 DEBUG - Stderr: /dev/mapper/3600a09803830357a392448666a38304f1: No such file or directory\r\n2016-08-31_10:01:11.18815\r\n2016-08-31_10:01:11.18815 sfdisk: cannot open /dev/mapper/3600a09803830357a392448666a38304f1 for reading\r\n```\r\n\r\nIt results in the problem where the variable `size` is not assigned, and it is still 0 as the initial value. The simplest way to fix the issue would be to modify `partitionPath` to `devicePath` at the line of [`size, err := p.GetDeviceSizeInBytes(partitionPath)`](https://github.com/cloudfoundry/bosh-agent/blob/master/platform/disk/sfdisk_partitioner.go#L181), but I am not sure if it's a good way to fix this issue. Need BOSH guys to give some comments/advice.\r\n\r\nThis issue has been already under discussion with @cppforlife, @dpb587-pivotal and @maximilien, I raised it here for better tracking.\r\n"},"comment":{"url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/comments/254680012","html_url":"https://github.com/cloudfoundry/bosh-agent/issues/92#issuecomment-254680012","issue_url":"https://api.github.com/repos/cloudfoundry/bosh-agent/issues/92","id":254680012,"user":{"login":"cppforlife","id":185847,"avatar_url":"https://avatars.githubusercontent.com/u/185847?v=3","gravatar_id":"","url":"https://api.github.com/users/cppforlife","html_url":"https://github.com/cppforlife","followers_url":"https://api.github.com/users/cppforlife/followers","following_url":"https://api.github.com/users/cppforlife/following{/other_user}","gists_url":"https://api.github.com/users/cppforlife/gists{/gist_id}","starred_url":"https://api.github.com/users/cppforlife/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cppforlife/subscriptions","organizations_url":"https://api.github.com/users/cppforlife/orgs","repos_url":"https://api.github.com/users/cppforlife/repos","events_url":"https://api.github.com/users/cppforlife/events{/privacy}","received_events_url":"https://api.github.com/users/cppforlife/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T00:46:20Z","updated_at":"2016-10-19T00:46:20Z","body":"@mattcui I believe this issue was resolved after fixing multipath disk lookup? Can be closed?"}}
{"actor":{"display_login":"cppforlife"}}