File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -147,15 +147,24 @@ function mount_drive {
147
147
/sbin/mdadm --detail --scan > /etc/mdadm.conf
148
148
/sbin/blockdev --setra 32 $device_name
149
149
else
150
- device_name=$devices
150
+ device_name=" /dev/ $device_names "
151
151
fi
152
152
153
153
# Mount the $root_dir drive(s)
154
154
/sbin/mkfs.$fs_type $mount_options -f $device_name
155
- echo " $device_name /$root_dir auto noatime 0 0" | tee -a /etc/fstab
155
+ # We add an entry for the device to /etc/fstab so it is automatically mounted following a
156
+ # machine reboot. The device is not guaranteed to be assigned the same name across restarts so
157
+ # we use its UUID in order to identify it.
158
+ #
159
+ # We also specify type=$fs_type in the /etc/fstab entry because specifying type=auto on
160
+ # Amazon Linux AMI 2018.03 leads to the drive not being mounted automatically following a
161
+ # machine reboot.
162
+ device_uuid=$( blkid -o value -s UUID " $device_name " )
163
+ echo " Adding entry to /etc/fstab for device '$device_name ' with UUID '$device_uuid '"
164
+ echo " UUID=$device_uuid /$root_dir $fs_type noatime 0 0" | tee -a /etc/fstab
156
165
mkdir /$root_dir || true
157
166
chmod 777 /$root_dir
158
- mount -t $fs_type $device_name /$root_dir
167
+ mount -t $fs_type " UUID= $device_uuid " /$root_dir
159
168
for sub_dir in $sub_dirs
160
169
do
161
170
mkdir -p /$root_dir /$sub_dir
You can’t perform that action at this time.
0 commit comments