Shrink guest on hosted platform: Difference between revisions

m
no edit summary
mNo edit summary
Line 15: Line 15:
  yum clean
  yum clean


Next, shut down any services that depend on enough available disk space to run.
Then shut down any services that depend on having enough available disk space to run.


The reason we are doing this is that we are going to write out zero's to the file system until the file system is full and we do not want any application - for example a database system like mySQL or postgreSQL - to run out of disk space while we are zeroing out the file system. If mySQL would try to write when your disk is full you risk a corrupted database. So this step is important!
The reason for this is that we are going to write out zero's to the file system until the file system is full and we do not want any application - for example a database system like mySQL or postgreSQL - to run out of disk space while we are zeroing out the file system. If mySQL would try to write when your disk is full you risk a corrupted database. So this step is important!


Next run:
Next run:
Line 23: Line 23:
  cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
  cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill


to fill the unused space with zeros.
to fill the unused space with zeros and then remove the "zero.fill" that has all the zero's.


As this command writes out zero's to the disk until it runs out of disk space, you will get an error "No space left on the device". This is expected.
As this command writes to the disk until it runs out of disk space, you will get an error "No space left on the device". This is expected.


==== Zero out unused space on a Windows VM ====
==== Zero out unused space on a Windows VM ====
Line 38: Line 38:
Careful!
Careful!


As of sdelete v1.6 -c and -z have changed meanings, many instructions say -c zeros free space, this is no longer the case, it zeros the space then fills with random data in accordance with DOD spec: DOD 5220.22-M, the trigger to zero space with 0x00 has changed to -z!
As of sdelete v1.6 -c and -z have changed meanings, many instructions say -c zeros free space, this is no longer the case, it zeros the space then fills with random data in accordance with DOD spec: DOD 5220.22-M, random data will prevent the reclaim logic from working.
 
The trigger to zero space with 0x00 has changed to -z!


=== Shrink the disk ===
=== Shrink the disk ===
1,274

edits