Commit 1c4928cb authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added support of boot up with RBD device as data partition

parent 44351a57
......@@ -101,17 +101,29 @@ else
pool=`/bin/uci -q get -c /data/etc/config rbd.rbd.pool`
image=`/bin/uci -q get -c /data/etc/config rbd.rbd.image`
if [ ! -z $monitors ] && [ ! -z $username ] && [ ! -z $secret ] && [ ! -z $pool ] && [ ! -z $image ] ; then
/bin/dhclient -1 -v -lf /dhclient.leases
/bin/dhclient -1 -lf /dhclient.leases
if [ $? -eq 0 ]; then
echo "$monitors name=$username,secret=$secret $pool $image" > /sys/bus/rbd/add_single_major
if [ -b /dev/rbd0 ]; then
fsck.ext4 -y /dev/rbd0 > /dev/null 2> /dev/null
resize2fs -f /dev/rbd0 > /dev/null 2> /dev/null
fstype=`/bin/lsblk -n -o FSTYPE /dev/rbd0`
if [ -z $fstype ]; then
echo "Creating new file system on RBD device"
mke2fs -t ext4 /dev/rbd0 > /dev/null 2> /dev/null
else
fsck.ext4 -y /dev/rbd0 > /dev/null 2> /dev/null
resize2fs -f /dev/rbd0 > /dev/null 2> /dev/null
fi
mount -o rw,discard /dev/rbd0 /rbd
cp -an /data/* /rbd
umount /data
mount --move /rbd /data
mkdir -p /run/systemd/system/final.target.requires
ln -s /lib/systemd/system/rbd-detach.service /run/systemd/system/final.target.requires/rbd-detach.service
else
echo "No RBD device is present, proceeding with local /data partition"
fi
else
echo "Could not obtain DHCP lease, proceeding with local /data partition"
fi
fi
......
......@@ -64,6 +64,8 @@ file /bin/echo /bin/echo 755 0 0
file /bin/rm /bin/rm 755 0 0
file /bin/mv /bin/mv 755 0 0
file /bin/cp /bin/cp 755 0 0
file /bin/ln /bin/ln 755 0 0
file /bin/mkdir /bin/mkdir 755 0 0
file /bin/mount /bin/mount 755 0 0
file /bin/umount /bin/umount 755 0 0
file /bin/sleep /bin/sleep 755 0 0
......@@ -75,6 +77,7 @@ file /bin/sed /bin/sed 755 0 0
file /bin/sfdisk /sbin/sfdisk 755 0 0
file /bin/fsck.ext4 /sbin/fsck.ext4 755 0 0
file /bin/resize2fs /sbin/resize2fs 755 0 0
file /bin/mke2fs /sbin/mke2fs 755 0 0
file /bin/xz /bin/xz 755 0 0
slink /bin/unxz xz 777 0 0
file /bin/dhclient /tmp/dhcp/client/dhclient 755 0 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment