Qual FS pode recuperar blocos não utilizados para o VirtualBox quando a imagem alocada dinamicamente é usada?

0

Eu gosto de usar imagens alocadas dinamicamente no VirtualBox.

É preferível se você gosta de distribuir sua imagem (lembre-se do Vagrant?).

O que o Linux FS pode recuperar blocos não utilizados para o VirtualBox quando a imagem alocada dinamicamente é usada?

Eu vi que os usuários executam:

sudo dd if=/dev/zero of=/EMPTY bs=1M || : ; rm -f /EMPTY

para reduzir imagens VDI.

Também todos sabemos sobre o comando TRIM ATA para unidades SSD ( discard opção para mount ) ...

    
por gavenkoa 14.10.2018 / 16:18

1 resposta

0

Estado dos documentos oficiais: link

VBoxManage storageattach <UUID> --nonrotational :

This switch allows to enable the non-rotational flag for virtual hard disks. Some guests (i.e. Windows 7+) treat such disks like SSDs and don't perform disk fragmentation on such media.

VBoxManage storageattach <UUID> --discard :

This switch enables the auto-discard feature for the virtual hard disks. This specifies that a VDI image will be shrunk in response to the trim command from the guest OS. The following requirements must be met:

The disk format must be VDI.

The size of the cleared area must be at least 1MB.

VirtualBox will only trim whole 1MB blocks. The VDIs themselves are organized into 1MB blocks, so this will only work if the space being TRIM-ed is at least a 1MB contiguous block at a 1MB boundary. On Windows, occasional defrag (with "defrag.exe /D"), or under Linux running "btrfs filesystem defrag" as a background cron job may be beneficial.

Notes: the Guest OS must be configured to issue trim command, and typically this means that the guest OS is made to 'see' the disk as an SSD. Ext4 supports -o discard mount flag; OSX probably requires additional settings. Windows ought to automatically detect and support SSDs - at least in versions 7, 8 and 10. Linux exFAT driver (courtesy of Samsung) supports the trim command.

It is unclear whether Microsoft's implementation of exFAT supports this feature, even though that file system was originally designed for flash.

Alternatively, there are ad hoc methods to issue trim, e.g. Linux fstrim command, part of util-linux package. Earlier solutions required a user to zero out unused areas, e.g. using zerofree, and explicitly compact the disk - only possible when the VM is offline.

Então, armazenamento definido como:

<AttachedDevice discard="true" nonrotational="true" type="HardDisk">

com FS como Ext4 / Btrfs / JFS / XFS / F2FS / VFAT montado com -o discard deve funcionar ...

O suporte TRIM UPDATE no VirtualBox ainda é instável: link

Veja também link

    
por 14.10.2018 / 19:32