From f31619dc433d8e955cfe9c7abb6bcddb337e43cd Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 1 Feb 2016 06:46:10 -0500 Subject: Label disk on format and create persistence.conf file to get live-boot to set the correct persistence. --- scripts/install/install-get-partition | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/install/install-get-partition') diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index eee0dc73..b238f787 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -652,7 +652,7 @@ make_filesystem () { lecho "Creating filesystem on /dev/$ldrive..." progress_indicator start - output=$(mkfs -t $ROOT_FSTYPE /dev/$ldrive 2>&1) + output=$(mkfs -L persistence -t $ROOT_FSTYPE /dev/$ldrive 2>&1) status=$? if [ "$status" != 0 ]; then echo -e "Error: couldn't create the root filesystem.\nSee $INSTALL_LOG for further details.\nExiting..." -- cgit v1.2.3 From 9cd1c2f0b577836043b25dfab4d27f03cf587b83 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 1 Feb 2016 11:56:44 -0500 Subject: Rename "live-rw" to only "rw". --- scripts/install/install-get-partition | 8 ++++---- scripts/install/install-image-existing | 2 +- scripts/install/install-image-new | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts/install/install-get-partition') diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index b238f787..b17aa563 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -480,7 +480,7 @@ save_image_config() { rm -fr /mnt/config mkdir /mnt/config - output=$(cp -pR /mnt/tmp/boot/$image_name/live-rw/config/* /mnt/config) + output=$(cp -pR /mnt/tmp/boot/$image_name/rw/config/* /mnt/config) if [ -n "$output" ]; then echo -e "Warning: error in copying the old config partition.\nSee $INSTALL_LOG for more details." @@ -492,7 +492,7 @@ save_image_config() { save_image_keys() { image_name=$1 - if [ ! -d /mnt/tmp/boot/$image_name/live-rw/etc/ssh ]; then + if [ ! -d /mnt/tmp/boot/$image_name/rw/etc/ssh ]; then echo "No SSH keys found on $image_name, so none can be saved." return; fi @@ -506,7 +506,7 @@ save_image_keys() { fi mkdir -p /mnt/ssh - output=$(cp -p /mnt/tmp/boot/$image_name/live-rw/etc/ssh/ssh_host_* /mnt/ssh) + output=$(cp -p /mnt/tmp/boot/$image_name/rw/etc/ssh/ssh_host_* /mnt/ssh) if [ -n "$output" ]; then echo -e "Warning: error in copying the old ssh keys." @@ -552,7 +552,7 @@ save_old_info() { image_dirs=/mnt/tmp/boot/* for dir in $image_dirs; do - if [ -f $dir/live-rw/config/.vyatta_config ]; then + if [ -f $dir/rw/config/.vyatta_config ]; then item=${dir##/mnt/tmp/boot/} images=($item ${images[@]}) diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing index 7d58cd96..454ae749 100755 --- a/scripts/install/install-image-existing +++ b/scripts/install/install-image-existing @@ -155,7 +155,7 @@ echo "Installing \"$NEWNAME\" image." # create the new release directories REL_ROOT=$BOOT_DIR/$NEWNAME -RW_DIR="$REL_ROOT/live-rw" +RW_DIR="$REL_ROOT/rw" if ! mkdir -p "$RW_DIR"; then failure_exit 'Cannot create directory for new release.' fi diff --git a/scripts/install/install-image-new b/scripts/install/install-image-new index 32c5f3e4..d6427500 100755 --- a/scripts/install/install-image-new +++ b/scripts/install/install-image-new @@ -62,9 +62,9 @@ echo "OK. This image will be named: $image_name" # make the dir for the new version mkdir -p $WRITE_ROOT/boot/$image_name # make dir for backing store -rw_dir=$WRITE_ROOT/boot/$image_name/live-rw +rw_dir=$WRITE_ROOT/boot/$image_name/rw mkdir -p $rw_dir -work_dir=$WRITE_ROOT/boot/$image_name/live-work +work_dir=$WRITE_ROOT/boot/$image_name/work mkdir -p $work_dir echo Copying squashfs image... -- cgit v1.2.3 From e121ff7ee674797223aa4bdfbeef674e5faab330 Mon Sep 17 00:00:00 2001 From: Kim Date: Mon, 20 Mar 2017 21:26:35 +0100 Subject: exclude install medium from raid disk count --- scripts/install/install-get-partition | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts/install/install-get-partition') diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index b17aa563..0ddbd443 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -195,6 +195,14 @@ check_for_new_raid () { drives=$(cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' \ | egrep -v "[0-9]$" | egrep -v "^$") + for instdrv in $drives + do + if mount | grep iso9660 | grep -q $instdrv + then + drives=${drives//"$instdrv"/} + fi + done + numdrives=`echo $drives | wc -w` # Need at least two drives for RAID-1. We don't yet have the code -- cgit v1.2.3 From 28ab553cfbe8d682314d61d0bac520deacfa14c7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 27 Dec 2017 22:29:53 +0100 Subject: T496: remove diagnostic partition for RAID1 installs --- debian/changelog | 6 ++++++ scripts/install-system | 21 +-------------------- scripts/install/install-get-partition | 22 ++-------------------- scripts/vyatta-grub-setup | 27 --------------------------- 4 files changed, 9 insertions(+), 67 deletions(-) (limited to 'scripts/install/install-get-partition') diff --git a/debian/changelog b/debian/changelog index e69f9e04..d1169cde 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg-system (0.20.44+vyos2+current6) unstable; urgency=medium + + * T496: remove diagnostic partition for RAID1 installs + + -- Christian Poessinger Wed, 27 Dec 2017 23:32:44 +0100 + vyatta-cfg-system (0.20.44+vyos2+current5) unstable; urgency=medium * T488: GRUB can't boot from software RAID diff --git a/scripts/install-system b/scripts/install-system index 108153da..e8464951 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -399,7 +399,7 @@ check_for_new_raid () { # # Partition creation variables are in units of megabytes. part_start_offset=2 - part_diag_size=60 + data_dev=1 if [ $drivesize1 -lt $drivesize2 ]; then root_size=$drivesize1 @@ -407,25 +407,6 @@ check_for_new_raid () { root_size=$drivesize2 fi - let min_size_with_diag=${MIN_ROOT}+${part_diag_size} - if [ $root_size -ge $min_size_with_diag ]; then - echo "Would you like me to create a $part_diag_size MB partition for diagnostics?" - echo -n "(Yes/No) [No]: " - diag_response=$(get_response "No" "Yes No Y N") - if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then - for drive in $drives - do - echo "Creating diag partition on drive $drive" - create_partitions "$drive" $part_diag_size $part_start_offset "no" - sfdisk --change-id /dev/$drive 1 0x6 - done - data_dev=2 - let part_start_offset+=$part_diag_size - else - data_dev=1 - fi - fi - let root_size-=$part_start_offset for drive in $drives diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index 0ddbd443..f1b373ae 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -259,12 +259,12 @@ check_for_new_raid () { done # Need to leave space on both disks between the MBR and the start - # of the first partition for grub. Grub needs to embed a large + # of the first partition for grub. Grub needs to embed a large # boot image there when booting off RAID devices. # # Partition creation variables are in units of megabytes. part_start_offset=2 - part_diag_size=60 + data_dev=1 if [ $drivesize1 -lt $drivesize2 ]; then root_size=$drivesize1 @@ -272,24 +272,6 @@ check_for_new_raid () { root_size=$drivesize2 fi - let min_size_with_diag=${MIN_ROOT}+${part_diag_size} - if [ $root_size -ge $min_size_with_diag ]; then - echo "Would you like me to create a $part_diag_size MB partition for diagnostics?" - echo -n "(Yes/No) [No]: " - diag_response=$(get_response "No" "Yes No Y N") - if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then - for drive in $drives; do - echo "Creating diag partition on drive $drive" - create_partitions "$drive" $part_diag_size $part_start_offset "no" - sfdisk --change-id /dev/$drive 1 0x6 - done - data_dev=2 - let part_start_offset+=$part_diag_size - else - data_dev=1 - fi - fi - let root_size-=$part_start_offset for drive in $drives; do diff --git a/scripts/vyatta-grub-setup b/scripts/vyatta-grub-setup index d263eff3..ea4dc905 100755 --- a/scripts/vyatta-grub-setup +++ b/scripts/vyatta-grub-setup @@ -133,11 +133,6 @@ if [ -n "$xen_kernel_version" ] || [ -n "$union_xen_kernel_version" ]; then default_console=0 fi -# Check for diagnostic partition residing in first partition of drive -# holding the root partition. - -diag_drive_number="" - if [ ${ROOT_PARTITION:0:2} = "md" ]; then # Select the first disk in the RAID group to look for diag partition on root_disks=`echo /sys/block/$ROOT_PARTITION/slaves/*` @@ -149,20 +144,6 @@ else root_disk=${ROOT_PARTITION:0:${#ROOT_PARTITION}-1} fi -# If the root partition is not occupying the first partition, then we -# can look for a diag partition there. -if [ "$ROOT_PARTITION" != "${root_disk}1" ]; then - first_part_fstype=`fdisk -l /dev/$root_disk | grep ^/dev/${root_disk}1 | awk '{ print $6 }'` - - if [ "$first_part_fstype" = "FAT16" -o "$first_part_fstype" = "Dell" ]; then - # Translate the Linux drive letter (e.g. the "a" in "/dev/sda") into - # a drive number that grub uses. i.e. "a" = 0, "b" = 1, etc. - diag_drive_letter=${root_disk:2:1} - diag_drive_number=`echo $diag_drive_letter | od -t u1 -N 1 | awk '{ print $2 }'` - let diag_drive_number-=97 - fi -fi - ( # create the grub.cfg file for grub # The "default=" line selects which boot option will be used by default. @@ -318,14 +299,6 @@ fi echo -e "\tinitrd $reset_boot_path/initrd.img" echo -e "}" - if [ -n "$diag_drive_number" ]; then - echo - echo -e "menuentry \"Diagnostics\" {" - echo -e "\tchainloader (hd$diag_drive_number,1)+1" - echo -e "}" - fi - - ) >"$ROOTFSDIR"/boot/grub/grub.cfg ( [ -s /boot/grub/menu.lst ] && -- cgit v1.2.3 From 42b06c04970392d7f2df8fdbcfa9345cfab95f33 Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 22 Feb 2018 11:40:47 +0100 Subject: sometimes drives report they are not aligned And then on reboot it hangs where it should start grub --- scripts/install/install-get-partition | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/install/install-get-partition') diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index f1b373ae..a8590031 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -688,7 +688,12 @@ create_partitions() { lecho "Creating root partition on /dev/$ldrive" # Make the root partition - output=$(parted --script --align optimal /dev/$ldrive mkpart primary 0% $root_part_size) + # if optimal_io_size is empty use default of 2048s + if [ $(cat /sys/block/$ldrive/queue/optimal_io_size) -gt 0 ]; then + output=$(parted --script --align optimal /dev/$ldrive mkpart primary 0% $root_part_size) + else + output=$(parted --script --align optimal /dev/$ldrive mkpart primary 2048s $root_part_size) + fi status=$? if [ "$status" != 0 ]; then echo -e "Error creating primary partition on $ldrive.\nPlease see $INSTALL_LOG for more details.\nExiting..." -- cgit v1.2.3 From fba795a09ae9d088a2403b5eaf2bc13e72138a62 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 31 May 2018 01:49:30 +0200 Subject: T232: force FAT label creation before creating the root partition. --- scripts/install/install-get-partition | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'scripts/install/install-get-partition') diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition index a8590031..5ea4845e 100755 --- a/scripts/install/install-get-partition +++ b/scripts/install/install-get-partition @@ -669,20 +669,17 @@ create_partitions() { exit 1 fi + # Force FAT label creation + lecho "Creating a new disklabel on $ldrive" + parted -s /dev/$ldrive mklabel msdos + # Make sure you can print disk info using parted parted --script /dev/$ldrive p >/dev/null 2>&1 - # If unable to read disk, it's likely it needs a disklabel + # If we still can't, something has gone terribly wrong if [ "$?" != "0" ]; then - lecho "Creating a new disklabel on $ldrive" - lecho "parted /dev/$ldrive mklabel msdos" - output=$(parted -s /dev/$ldrive mklabel msdos) - - parted --script /dev/$ldrive p >/dev/null 2>&1 - if [ "$?" != "0" ]; then - echo "Unable to read disk label. Exiting." - exit 1 - fi + echo "Unable to read disk label. Exiting." + exit 1 fi lecho "Creating root partition on /dev/$ldrive" -- cgit v1.2.3