microsoft / diskspd-for-linux

A disk io load-generator and benchmarking tool for Linux, based on the Windows tool diskspd.
MIT License
94 stars 16 forks source link

not work on Ubuntu 20.04.3 #15

Open osakanataro opened 2 years ago

osakanataro commented 2 years ago

I compled latest source on Ubuntu 20.04.3. execute diskspd error with non specific device.

$ sudo diskspd -v -c100M testfile
Unexpected error '2: No such file or directory' when statting /dev/nvme0c0n1!
stat: No such file or directory
$ sudo diskspd -v -d60 -b4K -r -w0 -L /dev/nvme1n1
Unexpected error '2: No such file or directory' when statting /dev/nvme0c0n1!
stat: No such file or directory
$ sudo diskspd -v -d60 -b4K -r -w0 -L /dev/nvme1
Unexpected error '2: No such file or directory' when statting /dev/nvme0c0n1!
stat: No such file or directory
$

/dev/nvme0c0n1 not foud. why /dev/nvme0c0n1 ?

$ ls -l /dev/nvme*
crw------- 1 root root 239, 0 Dec 21 17:43 /dev/nvme0
brw-rw---- 1 root disk 259, 1 Dec 21 17:43 /dev/nvme0n1
crw------- 1 root root 239, 1 Dec 21 17:43 /dev/nvme1
brw-rw---- 1 root disk 259, 3 Dec 21 17:43 /dev/nvme1n1
$ ls -ld /sys/block/nvme*
lrwxrwxrwx 1 root root 0 Dec 21 17:47 /sys/block/nvme0c0n1 -> ../devices/pci0000:64/0000:64:02.0/0000:65:00.0/nvme/nvme0/nvme0c0n1
lrwxrwxrwx 1 root root 0 Dec 21 17:47 /sys/block/nvme0n1 -> ../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
lrwxrwxrwx 1 root root 0 Dec 21 17:47 /sys/block/nvme1c1n1 -> ../devices/pci0000:64/0000:64:03.0/0000:66:00.0/nvme/nvme1/nvme1c1n1
lrwxrwxrwx 1 root root 0 Dec 21 17:47 /sys/block/nvme1n1 -> ../devices/virtual/nvme-subsystem/nvme-subsys1/nvme1n1
$

Ubuntu 20.04.3 LTS kernel 5.4.0-91-generic #102-Ubuntu gcc 9.3.0-17 g++ 9.3.0-17

osakanataro commented 2 years ago

i tried gcc/g++ 8.4.0-3ubuntu2 on Ubuntu 20.04.3 env. same problem occurred.

osakanataro commented 2 years ago

temporary workaround

$ git diff
diff --git a/src/sys_info.cc b/src/sys_info.cc
index b9a5175..d71c8d2 100644
--- a/src/sys_info.cc
+++ b/src/sys_info.cc
@@ -178,7 +178,7 @@ namespace diskspd {
                        if (err) {
                                fprintf(stderr, "Unexpected error '%d: %s' when statting %s!\n", errno, strerror(errno), dev_path.c_str());
                                perror("stat");
-                               exit(1);
+                               //exit(1);
                        }
                        //printf("mapping %u,%u to %s\n", major(dev_stat.st_rdev), minor(dev_stat.st_rdev), str.c_str());
                        // map it for later!
@@ -311,7 +311,7 @@ namespace diskspd {

                if (!schedfile.is_open()) {
                        fprintf(stderr, "Couldn't open scheduler file for device %s\n", device.c_str());
-                       exit(1);
+                       //exit(1);
                }

                std::getline(schedfile, line);
$