1

I am writing/reading to an SSD over NVMe. I would like to unmounts the SSD partitions and remount them after writing and before reading so as to avoid caching problems. It seems when I try to perform this operation, I get an error saying that the device is busy and it does not perform this action.

Here are the commands

/root/bin/mountfs -u sleep 5 /root/bin/mountfs -m sleep 10 

Here is mountfs

#!/bin/bash # Mount/unmount ext4 file systems exit_status=1 if [ "-m" = "$1" ] then mount -t ext4 /fsmnt/fs1 mount -t ext4 /fsmnt/fs2 mount -t ext4 /fsmnt/fs3 mount -t ext4 /fsmnt/fs4 exit_status=0 elif [ "-u" = "$1" ] then umount /fsmnt/fs1 umount /fsmnt/fs2 umount /fsmnt/fs3 umount /fsmnt/fs4 exit_status=0 else echo "mountfs -m | -u" fi exit $exit_status 

Is there any way in bash to programmatically wait for all reads/writes to complete, so the devices are not busy and I can successfully remount the partitions to clear NVMe Controller/OS caches?

6
  • Maybe a filesystem type of autofs is an option? Commented Nov 20, 2017 at 15:46
  • does running sync help you immediately unmount the filesystems? Commented Nov 20, 2017 at 17:24
  • see also unix.stackexchange.com/a/28575/117549 as a possible way to keep writes synchronized Commented Nov 20, 2017 at 17:31
  • I think it may have been some fpga hardware we were testing that served as a nvme bridge. seems to work fine with the card I am using Commented Nov 20, 2017 at 19:46
  • Do you still need a solution to this, or was it bad hardware? Commented Nov 20, 2017 at 20:30

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.