Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce SONiC migration partition from 8G to 1G. #1343

Merged
merged 4 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl
sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net

# Hook into initramfs: resize root partition after migration from another NOS to SONiC on Dell switches
sudo cp files/initramfs-tools/resize-rootfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs

## Hook into initramfs: after partition mount and loop file mount
## 1. Prepare layered file system
## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs)
Expand Down
2 changes: 1 addition & 1 deletion build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then
echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB"
fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE

## Generate a compressed 8GB partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer
## Generate a partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer
## Run the installer
## The 'build' install mode of the installer is used to generate this dump.
sudo chmod a+x $OUTPUT_ONIE_IMAGE
Expand Down
1 change: 1 addition & 0 deletions files/initramfs-tools/mke2fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ esac
copy_exec /sbin/mke2fs
copy_exec /sbin/sfdisk
copy_exec /sbin/fdisk
copy_exec /sbin/resize2fs

fstypes="ext4 ext3"

Expand Down
24 changes: 24 additions & 0 deletions files/initramfs-tools/resize-rootfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

case $1 in
prereqs)
exit 0
;;
esac

# Extract kernel parameters
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
root=*)
root_dev="${x#root=}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the root can be uuid, if later we decided to change to uuid, then this will break.

;;
resize-rootfs)
[ -z "$root_dev" ] && exit 0
resize2fs -f $root_dev
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resize-rootfs may come after root label. so, can you move resize2fs out of the for loop?

if [ $? != 0 ]; then
echo "ERROR: Unable to resize the root file system. Manual intervention needed to fix the issue."
fi
;;
esac
done
2 changes: 1 addition & 1 deletion onie-image.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin
OUTPUT_RAW_IMAGE=target/sonic-$TARGET_MACHINE.raw

### Raw image size in MB
RAW_IMAGE_DISK_SIZE=8192
RAW_IMAGE_DISK_SIZE=1024

## Output file name for aboot installer
OUTPUT_ABOOT_IMAGE=target/sonic-aboot-$TARGET_MACHINE.swi
Expand Down