mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 17:46:38 +00:00
Support OS install on nvme disk
This commit is contained in:
parent
aeaa863cb2
commit
de705f06db
@ -13,7 +13,7 @@
|
||||
# type, select the first one.
|
||||
# 3. Select the default one: /dev/sda.
|
||||
#
|
||||
# Output: /tmp/xcat.install_disk
|
||||
# Output: Install disk name written to /tmp/xcat.install_disk
|
||||
#
|
||||
#-----------------------------------------------------------
|
||||
|
||||
@ -31,7 +31,7 @@ tmpfile="$tmpdir/getinstalldisk_"
|
||||
|
||||
if [ -z "$install_disk" ]; then
|
||||
|
||||
echo "[get_install_disk]Information from /proc/partitions:"
|
||||
echo "[get_install_disk]Contents of /proc/partitions:"
|
||||
cat /proc/partitions
|
||||
echo ""
|
||||
|
||||
@ -67,6 +67,7 @@ if [ -z "$install_disk" ]; then
|
||||
mkdir -p $mount_dir;
|
||||
|
||||
disk_array=""
|
||||
umount_rc=0
|
||||
|
||||
for partition in $partitions; do
|
||||
echo "[get_install_disk]Check the partition $partition."
|
||||
@ -107,7 +108,13 @@ if [ -z "$install_disk" ]; then
|
||||
# It seems the kernel file in ubuntu and sles are named like vmlinux, but in RH it is called vmlinuz
|
||||
# To check both vmlinux and vmlinuz, use regular expression "vmlinu*" to match them
|
||||
for i in $ker_dir/vmlinu*; do
|
||||
disk_part=${partition%%[0-9]*}
|
||||
if [[ $partition = nvme* ]]; then
|
||||
# Expected nvme partition format example: nvme0n1p1
|
||||
disk_part=${partition%%p*}
|
||||
else
|
||||
# Expected sd partition format example: sda1
|
||||
disk_part=${partition%%[0-9]*}
|
||||
fi
|
||||
touch "$tmpfile$disk_part"
|
||||
disk_array=$disk_array"$disk_part "
|
||||
echo "[get_install_disk] The partition $partition has kernel file."
|
||||
@ -115,6 +122,10 @@ if [ -z "$install_disk" ]; then
|
||||
done
|
||||
|
||||
umount -l $mount_dir || echo "[get_install_disk] $partition umount failed."
|
||||
if [ $? -ne 0 ]; then
|
||||
# Preserve a umount failure RC
|
||||
umount_rc=$?
|
||||
fi
|
||||
else
|
||||
echo "[get_install_disk] Partition $partition mount failed or the partition is swap."
|
||||
fi
|
||||
@ -128,7 +139,13 @@ if [ -z "$install_disk" ]; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
rmdir $mount_dir;
|
||||
if [ $umount_rc -eq 0 ]; then
|
||||
rmdir $mount_dir;
|
||||
else
|
||||
# Do not remove $mount_dir if there was a umount failure, as it might wipe out
|
||||
# the contents of a still mounted disk
|
||||
echo "[get_install_disk]There was a umount failure earlier, not removing $mount_dir"
|
||||
fi
|
||||
|
||||
for file in $tmpfile*; do
|
||||
rm $file;
|
||||
@ -215,7 +232,7 @@ rm -rf $tmpdir;
|
||||
# Cannot find proper disk for OS install, select the default one "/dev/sda"
|
||||
if [ -z "$install_disk" ]; then
|
||||
install_disk="/dev/sda"
|
||||
echo "[get_install_disk]The default install_disk is $install_disk."
|
||||
echo "[get_install_disk]Choosing default install_disk is $install_disk."
|
||||
fi
|
||||
|
||||
# Output the result to $install_disk_file
|
||||
|
Loading…
x
Reference in New Issue
Block a user