VirtualBox vmdk продолжает расти

795
onknows

Я создал виртуальную машину с динамически расширяющимся диском - vmdk.

Через несколько недель пространство, используемое в ВМ, стабилизируется на уровне около 45 ГБ. На этой виртуальной машине есть несколько заданий, которые создают большое количество файлов, но затем они также удаляются.

Однако файл vmdk на хосте продолжает расти и расти. Пока он не использует все доступное пространство. 150GB.

Это нормально? Как я могу предотвратить это? Я всегда использовал динамически расширяемые диски, но эти машины всегда были недолговечными. Должен ли я использовать диск фиксированного размера для машин, которые я планирую продолжать работать дольше?

3
Вроде бы нормально. И удаление файла не влияет на vmdks. whs 8 лет назад 1

1 ответ на вопрос

3
davidgo

Your disk is set up to use "sparse" storage, which expands the disk actually used as necessary, so yes, to prevent this happening in future installations, you should configure the disk to be fixed size at configuration time.

VirtualBox supports sparse disk images, in fact they are called "dynamic" images and are the default. Deleting a file makes no size to the disk actually used as VirtualBox is operating at the block level, while the file is deleted at the filesystem level - and when a delete is done, space is simply marked as unused - the space is not actually zeroed out and made reclaimable.

Depending on your usage case and requirements, it might make sense for you to separate the data and OS, and store the data on NFS for similar, such that you centralise and have control of disk space at the file level - at the expense of slower IO and more complex setup.

Похожие вопросы