Inform kernel about /dev/nbd0 partition changes

This commit is contained in:
Reto Buerki 2012-12-09 10:23:37 +01:00 committed by Tobias Brunner
parent b24d3ed5fc
commit 97265abaf0
3 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ echo "Building base image"
[ `id -u` -eq 0 ] || die "You must be root to run $0"
check_commands debootstrap mkfs.ext3 qemu-img qemu-nbd sfdisk
check_commands debootstrap mkfs.ext3 partprobe qemu-img qemu-nbd sfdisk
# additional packages
EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb,cmake,libxerces-c2-dev,libltdl-dev,liblog4cxx10-dev,libboost-thread-dev,libboost-system-dev,git-core
@ -30,7 +30,6 @@ execute "qemu-img create -f qcow2 $ROOTFS ${ROOTFSSIZE}M"
log_action "Connecting image to NBD device $NBDEV"
execute "qemu-nbd -c $NBDEV $ROOTFS"
sync
log_action "Partitioning disk"
sfdisk /dev/nbd0 -D -uM >>$LOGFILE 2>&1 << EOF
@ -43,6 +42,7 @@ then
else
log_status 0
fi
partprobe $NBDEV
log_action "Creating ext3 filesystem"
execute "mkfs.ext3 $NBDPARTITION"

View File

@ -26,7 +26,7 @@ HOSTSDIR=$PWD/hosts
[ -f $BASE ] || die "Base image $BASE not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
check_commands qemu-img qemu-nbd
check_commands partprobe qemu-img qemu-nbd
load_qemu_nbd
@ -47,7 +47,7 @@ do
log_action "Creating guest image for $host"
execute "qemu-img create -b $BASE -f qcow2 $ROOTFSDIR/$host.qcow2" 0
execute "qemu-nbd -c $NBDEV $ROOTFSDIR/$host.qcow2" 0
sync
partprobe $NBDEV
execute "mount $NBDPARTITION $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/${host}/etc $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/default/etc $LOOPDIR" 0

View File

@ -22,7 +22,7 @@ echo "Building root image"
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
check_commands qemu-nbd
check_commands partprobe qemu-nbd
load_qemu_nbd
@ -37,7 +37,7 @@ execute "cp $ROOTFS $BASE"
log_action "Connecting base image to NBD device $NBDEV"
execute "qemu-nbd -c $NBDEV $BASE"
sync
partprobe $NBDEV
log_action "Mounting $NBDPARTITION to $LOOPDIR"
execute "mount $NBDPARTITION $LOOPDIR"