We have guest linux machine and need disable drive and at the same time guest machine should be in Runnig status.
Is it possible to do with VirtualBox SDK? or as there be anything else?
How to disable drive (in sata or sas controler) in runtime
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: How to disable drive (in sata or sas controler) in runtime
A lot more information needed. Define "disable" - does this mean sudden disconnect? Define "running" - do you mean the VM keeps running, or the OS keeps running? And which drive are you talking about? - system drive? swap drive? some removable peripheral drive?
Anyway, making a guess at some of these answers, the most obvious technique I can think of is to have the VDI on a USB stick, and just yank it as required. Expect corruption of course.
Anyway, making a guess at some of these answers, the most obvious technique I can think of is to have the VDI on a USB stick, and just yank it as required. Expect corruption of course.
-
ershovp
- Posts: 2
- Joined: 15. Jul 2010, 15:09
- Primary OS: Linux other
- VBox Version: OSE other
- Guest OSses: rhel, win
Re: How to disable drive (in sata or sas controler) in runtime
> A lot more information needed. Define "disable" - does this mean sudden disconnect? Define "running" - do you mean the VM keeps running, or the OS keeps
> running? And which drive are you talking about? - system drive? swap drive? some removable peripheral drive?
isable drive means - remove drive in guest VM (hard drive).
running means - guest VM running
So the question is: How do I remove the disk (hard disk) from a running VM. And disk is vdi fixed drive created with command `VBoxManage createhd --variant Fixed --filename drive.vdi --size 1000` and attached to VM.
> running? And which drive are you talking about? - system drive? swap drive? some removable peripheral drive?
isable drive means - remove drive in guest VM (hard drive).
running means - guest VM running
So the question is: How do I remove the disk (hard disk) from a running VM. And disk is vdi fixed drive created with command `VBoxManage createhd --variant Fixed --filename drive.vdi --size 1000` and attached to VM.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: How to disable drive (in sata or sas controler) in runtime
AFAIK hot swap is not a function of VirtualBox. Supposing you could do this as mpack says you should expect the drive to have corruption.
If the second drive is mounted manually then it may be possible to actually unmount it but here again I would test this in a non production environment due to the reasons stated above.
umount -l /dev/sdb1 (if that is sata and mounted manually on in fstab) This is actually done on the guest and files must not be in use.
If the second drive is mounted manually then it may be possible to actually unmount it but here again I would test this in a non production environment due to the reasons stated above.
umount -l /dev/sdb1 (if that is sata and mounted manually on in fstab) This is actually done on the guest and files must not be in use.
-
jdavidbakr
- Posts: 10
- Joined: 20. Mar 2009, 16:56
Re: How to disable drive (in sata or sas controler) in runtime
One use of VirtualBox is to test stuff on a virtual environment before taking it to a production system. Today I was experimenting with software RAID in Linux and wanted to see what would happen if I removed a running drive, and swapped it in with an empty drive, simulating a server with hot swap capability. I was able to do my testing but had to shut the machine down between swaps. Just saying this to say that there is occasion (although I admit quite obscure) that hot swapping a hard drive would be something you'd want to do.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: How to disable drive (in sata or sas controler) in runtime
Well, just because one person wants to do it (once) doesn't mean that VBox has to have features to support it which incidentally complicate the UI and perhaps also the runtime performance - ISTM this is way down the priority queue.
-
jdavidbakr
- Posts: 10
- Joined: 20. Mar 2009, 16:56
Re: How to disable drive (in sata or sas controler) in runtime
Oh, I absolutely agree, I wasn't trying to make an argument for getting something like this into the app.mpack wrote:Well, just because one person wants to do it (once) doesn't mean that VBox has to have features to support it which incidentally complicate the UI and perhaps also the runtime performance - ISTM this is way down the priority queue.
-
Martin
- Volunteer
- Posts: 2562
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: How to disable drive (in sata or sas controler) in runtime
Maybe what you are trying can be done with iSCSI by disabling the disk on the iSCSI target.