mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 08:54:51 +08:00 
			
		
		
		
	Make preallocation configurable
This commit is contained in:
		
							parent
							
								
									05d49ae434
								
							
						
					
					
						commit
						e29a0f1383
					
				@ -108,16 +108,24 @@ echo "Install: Creating partition table..."
 | 
				
			|||||||
SYSTEM="$TMP/sys.img"
 | 
					SYSTEM="$TMP/sys.img"
 | 
				
			||||||
SYSTEM_SIZE="4954537983"
 | 
					SYSTEM_SIZE="4954537983"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check free diskspace
 | 
					if [ "$ALLOCATE" != "Y" ]; then
 | 
				
			||||||
SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (( SYSTEM_SIZE > SPACE )); then
 | 
					  truncate -s "${SYSTEM_SIZE}" "${SYSTEM}"; 
 | 
				
			||||||
  echo "ERROR: Not enough free space to create virtual system disk." && exit 87
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then
 | 
					else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Check free diskspace
 | 
				
			||||||
 | 
					  SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (( SYSTEM_SIZE > SPACE )); then
 | 
				
			||||||
 | 
					    echo "ERROR: Not enough free space to create a 4 GB system disk." && exit 87
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then
 | 
				
			||||||
    rm -f "${SYSTEM}"
 | 
					    rm -f "${SYSTEM}"
 | 
				
			||||||
  echo "ERROR: Could not allocate file for virtual system disk." && exit 88
 | 
					    echo "ERROR: Could not allocate a file for the system disk." && exit 88
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PART="$TMP/partition.fdisk"
 | 
					PART="$TMP/partition.fdisk"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user