reduce the maximum capacity of a .vdi file - virtualbox

I am using linux. I have a dynamically alloted.vdi (virtual disk) with maximum capacity of 5.5gb. Presnetly the stuff inside is 500 mb and the stuff may increase till 750 mb
I want to reduce the maximum capacity from 5.5 gb to 1gb. Because my host system has only 3gb left and when i try to use the vdi (of max capacity 5.5gb) it doesnt work. If i shrink the harddisks maximum capacity to 1 gb then this vdi will open in virtual box.
is there any command using vboxmanage.
I also heard that if we convert to raw image we can then shrink.
so how to convert img and shrink

Use this to resize ur vdi and then reboot your vm with gparted live iso file http://gparted.org/livecd.php and resize it using gparted.
VBoxmanage modifyhd MyLinux.vdi --resize 100000

Related

Copy rootfs form UBIFS to RAM

I have a working Linux image stored in NOR flash. Every time I edit some file on this filesystem changes are stored permanently in NOR flash thus causing wearing out memory with time. I'm wondering is that possible to store image on NOR flash that will be read only and during boot will be copied to RAM, like e.g fitImage does? Even if I modify rootfs stored in RAM, after system reboot everything backs to its original form. How to achieve such a behavior?
Thanks.

In windows even small bytes leak showing high commit memory in resource monitor why it could happen?

We have an 64 bit application running on windows, for the fact we know it is leaking very few bytes of memory in the c++ code.But for a setup which has 16gb physical ram and 32gb pagefile.sys. Resource monitor is showing commit memory as 22gb and 900 MB in working set used by our process.
I knew for every process os will create virtual address space in pages and that number of addresses that will be depend on the 32 bit or 64 bit .I also knew that os will swap pages to disk i.e. pagefile.sys for running other apps.In windows i think page size is 4kb, what i want to know is if one byte has leaked in a page of 4 kb in physical ram , then after swapping to disk does it will show as 4kb is used instead of one byte by the process or not ?

VirtualBox .vdi drive does not grow

I have a CentOS guest system in a Windows host. The virtual drive was originally 20 GB, then I resized it to 60 using the VBoxManage utility.
VirtualBox reports the expected virtual size (see picture below), but the guest system keeps reporting it's out of storage space. Copying in some files above the limit fails, df reports it having only 20 GB for some reason.
Are there any extra steps I need to take to actually increase the size of the drive?
Guest system:
In my case, after resizing the partition with GParted and booting up the VM, I also had to extend the logical volume and then grow the file system to the available size:
(logged in as root)
lvextend -l +100%FREE /dev/centos/root
xfs_growfs /dev/centos/root
'df -h' then shows the new size.
Your disk is now having more space, but your partition still does not. You have to resize also partition to get the additional "physical" space to be available to the OS. As from you question is not clear what Centos version you use, assuming it's Centos7, i may recommend you to use lvextend
sudo lvextend -L+40G -r /dev/mapper/centos-root
Also, i recommend to make a snapshot of your VM hard drive, before doing any actual changes, so you can quickly rollback changes and start over.

Maximum RAM possible in NodeJS Addon

I am building a nodejs addon (C and C++) for speech recognition. Every speech request will need approx 30MB of RAM to allocate, acoustic models, language models, etc. I want to know the max of RAM that I am allowed to use.
I am asking this because after the 6th request (in task manager is equivalent +/- of 175,000k) the nodejs automatically exit.
Note: I am using 32bit version of nodejs in windows7 34 bits.
Currently, by default v8 has a memory limit of 512MB on 32-bit systems, and 1.4GB on 64-bit systems. The limit can be raised by setting --max_old_space_size to a maximum of ~1024 (~1 GB) (32-bit) and ~4096 (~4GB) (64-bit), but it is recommended that you split your single process into several workers if you are hitting memory limits.
increasing the memory limit in node.js:
node --max-old-space-size=1024 my-node-script.js #increase to 1gb
node --max-old-space-size=2048 my-node-script.js #increase to 2gb
node --max-old-space-size=3072 my-node-script.js #increase to 3gb
node --max-old-space-size=4096 my-node-script.js #increase to 4gb
node --max-old-space-size=5120 my-node-script.js #increase to 5gb
node --max-old-space-size=6144 my-node-script.js #increase to 6gb
node --max-old-space-size=7168 my-node-script.js #increase to 7gb
node --max-old-space-size=8192 my-node-script.js #increase to 8gb

C++ Qt - Get Physical Disk Size (Win32)

How can I get the physical size of all hard disks on the current computer using C++ / Qt framework on Windows? Just to be clear, if I have a 640 GB HDD, I want to the application to show 640 GB, not 596 GB of available space.
I know that Qt probably doesn't have a function I could use, because it has to be platform-specific, so I guess in this case something from the Win32 API. Unfortunately I can't use GetDiskFreeSpaceEx(), because I would only get the free/available disk space. I've read about using WMI, but I can't seem to find any usable code examples for this purpose.
I think this issue is mainly cosmetic as a result of inconsistencies in measurements used by Operating Systems and Hard Drive manufacturers. Check this wikipedia page for more information. Perhaps find a way to do the math while treating 1 Kilobyte as 1000 bytes (instead of 1024), 1 Megabyte as 1000 * 1000 and so on -- instead of 1 kilobyte as 1024 bytes etc.