ioctl: invalid argument for HDIO_GET_IDENTITYHow to troubleshoot udev not creating /dev/hda3 on gentoo...

Front derailleur hard to move due to gear cable angle

How does Howard Stark know this?

Understanding integration over Orthogonal Group

What does i386 mean on macOS Mojave?

Why was Endgame Thanos so different than Infinity War Thanos?

Why was castling bad for white in this game, and engine strongly prefered trading queens?

Early arrival in Australia, early hotel check in not available

Why was the Ancient One so hesitant to teach Dr. Strange the art of sorcery?

How do I tell my supervisor that he is choosing poor replacements for me while I am on maternity leave?

On studying Computer Science vs. Software Engineering to become a proficient coder

How can a Lich look like a human without magic?

How to select certain lines (n, n+4, n+8, n+12...) from the file?

Why in a Ethernet LAN, a packet sniffer can obtain all packets sent over the LAN?

SSD - Disk is OK, one bad sector

What is the best way for a skeleton to impersonate human without using magic?

How are one-time password generators like Google Authenticator different from having two passwords?

How can Thor be worthy?

Extracting sublists that contain similar elements

A curve pass via points at TiKz

How can dragons propel their breath attacks to a long distance

What stroke width Instagram is using for its icons and how to get same results?

How can I answer high-school writing prompts without sounding weird and fake?

Proof that the inverse image of a single element is a discrete space

For the erase-remove idiom, why is the second parameter necessary which points to the end of the container?



ioctl: invalid argument for HDIO_GET_IDENTITY


How to troubleshoot udev not creating /dev/hda3 on gentoo boot?Disk problems prevent me from booting, or set the disk to read-only. How do I fix the disk?Writing own daemon. systemd error: Failed to read PID from file: Invalid argumentHard-drive errorsIOCTL() Library for WindowsKdump.service FAILED centOS 7sysctl: setting key “net.ipv4.ip_forward”: Invalid argumentWhat causes this E474: Invalid argument error from my .vimrc?ssh_selinux_change_context: setcon failed with Invalid argument






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls.



For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32).



Here is my main part of code:



fd = open("/dev/sda", O_RDONLY);  // validated fd.
retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid);
if(retval < 0) {
perror("ioctl(HDIO_GET_IDENTITY)");
exit(3);
}


When I run(as root) the above code, I got below error:



ioctl(HDIO_GET_IDENTITY): Invalid argument


What is the wrong in the program?
Why I'm getting error?



Additional Info: OS: CentOS-6.5, kernel version: 2.6.32, IA:x86_64 (running on VMware).



Result of hdparm -i /dev/sda is



SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
HDIO_GET_IDENTITY failed: Invalid argument









share|improve this question
















bumped to the homepage by Community 26 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    3















    I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls.



    For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32).



    Here is my main part of code:



    fd = open("/dev/sda", O_RDONLY);  // validated fd.
    retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid);
    if(retval < 0) {
    perror("ioctl(HDIO_GET_IDENTITY)");
    exit(3);
    }


    When I run(as root) the above code, I got below error:



    ioctl(HDIO_GET_IDENTITY): Invalid argument


    What is the wrong in the program?
    Why I'm getting error?



    Additional Info: OS: CentOS-6.5, kernel version: 2.6.32, IA:x86_64 (running on VMware).



    Result of hdparm -i /dev/sda is



    SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    HDIO_GET_IDENTITY failed: Invalid argument









    share|improve this question
















    bumped to the homepage by Community 26 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      3












      3








      3








      I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls.



      For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32).



      Here is my main part of code:



      fd = open("/dev/sda", O_RDONLY);  // validated fd.
      retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid);
      if(retval < 0) {
      perror("ioctl(HDIO_GET_IDENTITY)");
      exit(3);
      }


      When I run(as root) the above code, I got below error:



      ioctl(HDIO_GET_IDENTITY): Invalid argument


      What is the wrong in the program?
      Why I'm getting error?



      Additional Info: OS: CentOS-6.5, kernel version: 2.6.32, IA:x86_64 (running on VMware).



      Result of hdparm -i /dev/sda is



      SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      HDIO_GET_IDENTITY failed: Invalid argument









      share|improve this question
















      I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls.



      For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32).



      Here is my main part of code:



      fd = open("/dev/sda", O_RDONLY);  // validated fd.
      retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid);
      if(retval < 0) {
      perror("ioctl(HDIO_GET_IDENTITY)");
      exit(3);
      }


      When I run(as root) the above code, I got below error:



      ioctl(HDIO_GET_IDENTITY): Invalid argument


      What is the wrong in the program?
      Why I'm getting error?



      Additional Info: OS: CentOS-6.5, kernel version: 2.6.32, IA:x86_64 (running on VMware).



      Result of hdparm -i /dev/sda is



      SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      HDIO_GET_IDENTITY failed: Invalid argument






      centos hard-disk c






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 18 '14 at 10:39







      gangadhars

















      asked Apr 18 '14 at 6:18









      gangadharsgangadhars

      34721021




      34721021





      bumped to the homepage by Community 26 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 26 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Is there a device /dev/sda in your system?
          What type is the driveid variable?
          Show us whole code, or try changing driveid to:



          struct hd_driveid driveid;


          Then you can print it's content, i.e.:



          printf("Firmware Revision=%.8sn",driveid.fw_rev);
          printf("Cylinders=%dn",driveid.cyls);


          Also check:
          http://lxr.free-electrons.com/source/include/linux/hdreg.h?v=2.6.32






          share|improve this answer


























          • driverid variable??

            – gangadhars
            Apr 18 '14 at 9:29











          • retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

            – tommy
            Apr 18 '14 at 9:43











          • first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

            – gangadhars
            Apr 18 '14 at 10:37











          • I added some extra part to my question. pls see the question again.

            – gangadhars
            Apr 18 '14 at 10:40













          • It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

            – tommy
            Apr 18 '14 at 11:55












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f125332%2fioctl-invalid-argument-for-hdio-get-identity%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Is there a device /dev/sda in your system?
          What type is the driveid variable?
          Show us whole code, or try changing driveid to:



          struct hd_driveid driveid;


          Then you can print it's content, i.e.:



          printf("Firmware Revision=%.8sn",driveid.fw_rev);
          printf("Cylinders=%dn",driveid.cyls);


          Also check:
          http://lxr.free-electrons.com/source/include/linux/hdreg.h?v=2.6.32






          share|improve this answer


























          • driverid variable??

            – gangadhars
            Apr 18 '14 at 9:29











          • retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

            – tommy
            Apr 18 '14 at 9:43











          • first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

            – gangadhars
            Apr 18 '14 at 10:37











          • I added some extra part to my question. pls see the question again.

            – gangadhars
            Apr 18 '14 at 10:40













          • It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

            – tommy
            Apr 18 '14 at 11:55
















          0














          Is there a device /dev/sda in your system?
          What type is the driveid variable?
          Show us whole code, or try changing driveid to:



          struct hd_driveid driveid;


          Then you can print it's content, i.e.:



          printf("Firmware Revision=%.8sn",driveid.fw_rev);
          printf("Cylinders=%dn",driveid.cyls);


          Also check:
          http://lxr.free-electrons.com/source/include/linux/hdreg.h?v=2.6.32






          share|improve this answer


























          • driverid variable??

            – gangadhars
            Apr 18 '14 at 9:29











          • retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

            – tommy
            Apr 18 '14 at 9:43











          • first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

            – gangadhars
            Apr 18 '14 at 10:37











          • I added some extra part to my question. pls see the question again.

            – gangadhars
            Apr 18 '14 at 10:40













          • It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

            – tommy
            Apr 18 '14 at 11:55














          0












          0








          0







          Is there a device /dev/sda in your system?
          What type is the driveid variable?
          Show us whole code, or try changing driveid to:



          struct hd_driveid driveid;


          Then you can print it's content, i.e.:



          printf("Firmware Revision=%.8sn",driveid.fw_rev);
          printf("Cylinders=%dn",driveid.cyls);


          Also check:
          http://lxr.free-electrons.com/source/include/linux/hdreg.h?v=2.6.32






          share|improve this answer















          Is there a device /dev/sda in your system?
          What type is the driveid variable?
          Show us whole code, or try changing driveid to:



          struct hd_driveid driveid;


          Then you can print it's content, i.e.:



          printf("Firmware Revision=%.8sn",driveid.fw_rev);
          printf("Cylinders=%dn",driveid.cyls);


          Also check:
          http://lxr.free-electrons.com/source/include/linux/hdreg.h?v=2.6.32







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 18 '14 at 11:57

























          answered Apr 18 '14 at 9:27









          tommytommy

          392




          392













          • driverid variable??

            – gangadhars
            Apr 18 '14 at 9:29











          • retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

            – tommy
            Apr 18 '14 at 9:43











          • first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

            – gangadhars
            Apr 18 '14 at 10:37











          • I added some extra part to my question. pls see the question again.

            – gangadhars
            Apr 18 '14 at 10:40













          • It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

            – tommy
            Apr 18 '14 at 11:55



















          • driverid variable??

            – gangadhars
            Apr 18 '14 at 9:29











          • retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

            – tommy
            Apr 18 '14 at 9:43











          • first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

            – gangadhars
            Apr 18 '14 at 10:37











          • I added some extra part to my question. pls see the question again.

            – gangadhars
            Apr 18 '14 at 10:40













          • It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

            – tommy
            Apr 18 '14 at 11:55

















          driverid variable??

          – gangadhars
          Apr 18 '14 at 9:29





          driverid variable??

          – gangadhars
          Apr 18 '14 at 9:29













          retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

          – tommy
          Apr 18 '14 at 9:43





          retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid); Is it struct or char or whatever?

          – tommy
          Apr 18 '14 at 9:43













          first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

          – gangadhars
          Apr 18 '14 at 10:37





          first I tried for char it thrown same error and then I tried struct hd_drive. I got same error.

          – gangadhars
          Apr 18 '14 at 10:37













          I added some extra part to my question. pls see the question again.

          – gangadhars
          Apr 18 '14 at 10:40







          I added some extra part to my question. pls see the question again.

          – gangadhars
          Apr 18 '14 at 10:40















          It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

          – tommy
          Apr 18 '14 at 11:55





          It's due the lack o drivers I suppose. If you select different device ie /dev/sr0 it works perfectly. Guess your using vmware player with centos livecd ?

          – tommy
          Apr 18 '14 at 11:55


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f125332%2fioctl-invalid-argument-for-hdio-get-identity%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

          The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

          Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...