diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2011-05-02 11:30:53 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2011-05-03 19:53:15 -0700 |
commit | b6871cf68a0b32f191d864aac34e6622970a828a (patch) | |
tree | b7d3514ff137f0a3d3609507310f347a79e66dce | |
parent | ae552cf567b52888f14fb2de551328c88bf9471f (diff) | |
download | vyatta-cfg-quagga-b6871cf68a0b32f191d864aac34e6622970a828a.tar.gz vyatta-cfg-quagga-b6871cf68a0b32f191d864aac34e6622970a828a.zip |
Adjust root partition offset based on disk size
On tiny disks, then it doesn't make sense to waste space by offsetting
root partition. On big disks, it doesn't hurt and it allows for running
on SSD.
-rwxr-xr-x | scripts/install-system | 11 | ||||
-rwxr-xr-x | scripts/install/install-get-partition | 17 |
2 files changed, 21 insertions, 7 deletions
diff --git a/scripts/install-system b/scripts/install-system index 4d712ee7..278e77dc 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -77,8 +77,8 @@ PARTITION='' # default file system type ROOT_FSTYPE="ext3" -# start of root partition (0% is magic to tell parted to align) -ROOT_OFFSET="0%" +# start of root partition (64 sectors == 32K bytes) +ROOT_OFFSET="64S" # Process ID of this script for the lame marketing spinner SPID=$$ @@ -1267,6 +1267,13 @@ setup_method_auto() { while [ $ROOT_MIN -gt $ROOT_PARTITION_SIZE ]; do # Get the size of the drive size=$(get_drive_size $INSTALL_DRIVE) + + # If drive is big, leave more space 512K bytes (1024 sectors) + # this is better for SSD + if (( $size > 10000 )); then + ROOT_OFFSET="1024S" + fi + echo -n "How big of a root partition should I create? ($ROOT_MIN"MB" - $size"MB") [$size]MB: " response=$(get_response "$size") # TODO: need to have better error checking on this value diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index debb2eaa..b15092a6 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -34,8 +34,8 @@ PARTITION='' # default file system type ROOT_FSTYPE='ext3' -# start of root partition (0% is magic to tell parted to align) -ROOT_OFFSET="0%" +# default start of root partition +ROOT_OFFSET="64S" warn_of_dire_consequences () { # Give the user a requisite warning that we are about to nuke their drive @@ -713,11 +713,18 @@ create_partitions() { fi } -# sets ROOT_FSTYPE based on disk size +# adjust root filesystem based on disk size set_root_fstype () { local drv=$1 - # always use ext3 for stability - ROOT_FSTYPE=ext3 + local sz=$(get_drive_size "$drv") + + # if disk is small, then don't waste space aligning + # otherwise align on 512K boundary for SSD etc + if (( $sz < 10000 )); then + ROOT_OFFSET="64S" + else + ROOT_OFFSET="1024S" + fi } # ask for user input on the parted and skip setup methods |