A Linux way to disable the Virtual CD on WD disks

According to Western Digital, there is no known way under Linux to disable (and hide) the “Virtual CD” (VCD) partition that can often be found on their external hard disks (such as the popular My Passport series).

No results with Google either, so I had to dig a little further. Please keep in mind that the following solution worked well for me, but that it could, potentially, brick your hard disk. You’ve been warned.


Here is the log output for my brand new WD My Passport:

Sep 01 15:41:07 thinkpad-linux kernel: scsi 6:0:0:0: Direct-Access     WD       My Passport 25A8 1005 PQ: 0 ANSI: 6
Sep 01 15:41:07 thinkpad-linux kernel: scsi 6:0:0:1: CD-ROM            WD       Virtual CD 25A8  1005 PQ: 0 ANSI: 6
Sep 01 15:41:07 thinkpad-linux kernel: scsi 6:0:0:2: Enclosure         WD       SES Device       1005 PQ: 0 ANSI: 6
Sep 01 15:41:07 thinkpad-linux kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0
Sep 01 15:41:07 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Spinning up disk...
Sep 01 15:41:07 thinkpad-linux kernel: sr 6:0:0:1: [sr0] scsi3-mmc drive: 51x/51x caddy
Sep 01 15:41:07 thinkpad-linux kernel: sr 6:0:0:1: Attached scsi CD-ROM sr0
Sep 01 15:41:07 thinkpad-linux kernel: sr 6:0:0:1: Attached scsi generic sg3 type 5
Sep 01 15:41:07 thinkpad-linux kernel: ses 6:0:0:2: Attached Enclosure device
Sep 01 15:41:07 thinkpad-linux kernel: ses 6:0:0:2: Attached scsi generic sg4 type 13
Sep 01 15:41:12 thinkpad-linux kernel: .
Sep 01 15:41:12 thinkpad-linux kernel: ready
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] 3906963456 512-byte logical blocks: (2.00 TB/1.82 TiB)
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Write Protect is off
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Mode Sense: 53 00 10 08
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] No Caching mode page found
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Assuming drive cache: write through
Sep 01 15:41:12 thinkpad-linux kernel:  sdc: sdc1
Sep 01 15:41:12 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Attached SCSI disk

See the virtual cd-rom at /dev/sr0? Also note that the hard disk appears as /dev/sdc on my system, so you will have to update the following commands accordingly if your disk has a different system letter.

Western Digital uses undocumented, vendor-unique SCSI mode pages. One of the page is page 0x20, which contains the information necessary to enable or disable the virtual cd.

First you need to install sdparm. Under Debian (and its derivatives) you can install it with

$ sudo apt-get install sdparm

Then run the following command (keep in mind to adjust the drive letter to match it with your WD hard disk), which reads out mode page 0x20 of your disk.

$ sudo sdparm --page=0x20 --hex /dev/sdc
[0x20] mode page:
    Current:
 00     a0 06 30 00 30 00 00 00
    Changeable:
 00     a0 06 00 00 23 00 00 00
    Default:
 00     a0 06 30 00 30 00 00 00
    Saved:
 00     a0 06 30 00 30 00 00 00 

Of interest is the fifth byte with the value 0x30 – or 00110000 in bits. By manipulating its second bit, we can disable or reenable the virtual cd. To disable it, run the following command:

sudo sdparm --page=0x20 --set 4:1:1=1 --save /dev/sdc

Now check out mode page 0x20 again:

$ sudo sdparm --page=0x20 --hex /dev/sdc
[0x20] mode page:
    Current:
 00     a0 06 30 00 32 00 00 00
    Changeable:
 00     a0 06 00 00 23 00 00 00
    Default:
 00     a0 06 30 00 30 00 00 00
    Saved:
 00     a0 06 30 00 32 00 00 00

That’s it! No more virtual disk. Unplug and plugin your hard disk, and check out the log files:

Sep 01 15:48:30 thinkpad-linux kernel: scsi 6:0:0:0: Direct-Access     WD       My Passport 25A8 1005 PQ: 0 ANSI: 6
Sep 01 15:48:30 thinkpad-linux kernel: scsi 6:0:0:1: Enclosure         WD       SES Device       1005 PQ: 0 ANSI: 6
Sep 01 15:48:30 thinkpad-linux kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0
Sep 01 15:48:30 thinkpad-linux kernel: ses 6:0:0:1: Attached Enclosure device
Sep 01 15:48:30 thinkpad-linux kernel: ses 6:0:0:1: Attached scsi generic sg3 type 13
Sep 01 15:48:30 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Spinning up disk...
Sep 01 15:48:32 thinkpad-linux kernel: .
Sep 01 15:48:35 thinkpad-linux kernel: ready
Sep 01 15:48:35 thinkpad-linux kernel: sd 6:0:0:0: [sdc] 3906963456 512-byte logical blocks: (2.00 TB/1.82 TiB)
Sep 01 15:48:35 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Write Protect is off
Sep 01 15:48:35 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Mode Sense: 53 00 10 08
Sep 01 15:48:35 thinkpad-linux kernel: sd 6:0:0:0: [sdc] No Caching mode page found
Sep 01 15:48:35 thinkpad-linux kernel: sd 6:0:0:0: [sdc] Assuming drive cache: write through

If you want to reenable the virtual disk, use the following command:

sudo sdparm --page=0x20 --set 4:1:1=0 --save /dev/sdc

One thought on “A Linux way to disable the Virtual CD on WD disks

  1. Thank you, Alexander, for this useful Post !

    I hav 2 brand new WD “My Passport”, 256 Gb and 512 Gb.
    They are excellent companions as media strorage for
    my RuneAudio music player !
    However, the can not be mounted as USB devices on my RPi3,
    because the WD VCD is masking the SSD.

    I attempted your recipie using a Fedora Workstation Live on a Laptop.
    I can read the Vendor Page 0x20 with the same result as you have presented.

    However, “sdparm” fails to modify the bit in question.

    I am a bit confused about the parameters for the “SET” command.
    According to this page (Linux Man Page)
    https://linux.die.net/man/8/sdparm
    the parameter should be :
    ## quote
    Instead of an acronym_name a field within a mode page can be described numerically with a :: tuple. These are the (origin 0) within the mode page, a (0 to 7 inclusive) and (1 to 64 inclusive). For example, the low level representation of the RCD bit (the “Read Cache Disable bit in the caching mode page) is “2:0:1”. The can optionally be given in hex (e.g. ‘–set=0x2:0:1’ or ‘–set=2h:0:1’). With this form the –page= option is required to establish which mode page is to be used.
    ##

    You want to set a bit in Byte #4 (first byte is number 0).
    The currrent value is : 0x30 = 0011_0000
    The new value should be : 0x32 = 0011_0010
    I think the parameters should be :
    Start Byte = 4 (5:th byte)
    Start Bit = 6
    Number of Bits = 1

    What do you say ?
    May be it is too hot here in Manila . . . . . .
    I am carefull and do not want to “brick” my unit, it is brand new !

    Best regards and Thanks !
    Per Linde’n

Leave a Reply

Your email address will not be published. Required fields are marked *