最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon ec2 - AWS, EC2 Instance, Windows, Userdata not able to set disk online with script - Stack Overflow

programmeradmin0浏览0评论

I have EC2 instance with template on cloudformation on AWS and if anything fails or instance is terminated my template created new instance with latest EBS backup. But this attached voleme to newly created instance is not online on the server(windows). I tried 2 different userdata scripts for setting mz volume online and none of this works. Can anyone help me where i'm doing misstake:

This is my old code

$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
sleep 5
Set-Disk -InputObject $(Get-Disk -Number 1) -IsReadOnly $false
echo "Volume - $volumeId back ONLINE."

This is my new code

$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
echo "Disk $secondDisk is now online."
Set-Disk -InputObject (Get-Disk -Number $secondDisk) -IsReadOnly $false
echo "Disk $secondDisk is no longer ReadOnly."
echo "Disk $secondDisk is now ready to be used with existing data."

Thanks for advice

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论