Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Discussions related to using VirtualBox on Windows hosts.
Post Reply
krishpm
Posts: 4
Joined: 13. Mar 2020, 00:07

Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by krishpm »

Hello,
I am running Ubuntu 18.04 guest OS on Widows host.

I have connected an SMR drive to the system.

1. Windows host is able to recognize the SMR drive.

2. On Linux guest :also sees the SMR drive and reports the size of the drive and reports the size of the drive correctly:
sudo fdisk -l
Disk /dev/sdc: 13.7 TiB, 15000173281280 bytes, 29297213440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

3. But when I try to format this drive using dmzadm command, it reports that the drive is not a zoned drive.
vagrant@ubuntu-bionic:~$ sudo dmzadm --format /dev/sdc --force
sdc: Not a zoned block device

Linux OS is not able to see the zones on the SMR drive. Is there any ZAC / ZBC extension we can add to Virtualbox ? or can Virtualbox be used with SMR drives /zoned drives?

Thanks.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by scottgus1 »

Per https://en.wikipedia.org/wiki/Shingled_ ... _recording:
Device-managed SMR devices hide this complexity by managing it in the firmware, presenting an interface like any other hard disk. Other SMR devices are host-managed and depend on the operating system to know how to handle the drive
If your drive is not a 'device-managed' drive, then you apparently need to have drivers in each OS that accesses the drive. Virtualbox does not enter into the equation.
krishpm wrote:On Linux guest :also sees the SMR drive
If you pass the drive via USB, the Linux OS would handle the drive directly, as much as the USB standard would permit. If this drive is attached via raw-disk access, also the Linux OS would handle the drive directly. If you set up a guest virtual drive file on the special drive, Linux will not know anything special about the drive and treat it as any normal guest drive.
krishpm
Posts: 4
Joined: 13. Mar 2020, 00:07

Re: Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by krishpm »

Appreciate your response.

I have attached the drive via raw-disk access but still Linux guest OS (Ubuntu 18.04) reports that the device is not zoned drive when I try to format the drive using dmzadm.

To attach the SMR drive to Linux Guest OS,
my Vagrant file provisioning looks like this :
config.vm.provider "virtualbox" do |v|
file_to_be_disk = "./new/ma07_disk.vmdk"
if ARGV[0] == "up" && ! File.exist?("./new/ma07_disk.vmdk")
system("vboxmanage internalcommands createrawvmdk -filename ./new/ma07_disk.vmdk -rawdisk \\\\.\\PhysicalDrive2")
end
v.customize [ "storageattach", :id, "--storagectl", "SCSI", "--port", "2", "--device", "0", "--type", "hdd", "--medium", "./new/ma07_disk.vmdk"]
end

Is there any option which I should use with "storageattach" command or "createrawvmdk" command?

Thanks
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by scottgus1 »

Regrettably, we have no idea how to run Vagrant. You can ask them, or try the raw-disk only though running Virtualbox alone, without any Vagrant scripts.

To test raw-disk, try a regular drive and see if Linux can configure it. If it can you might assume the raw-disk setup is correct.

If you are attaching via raw-disk successfully, then the communication takes place between the guest OS and the disk directly without going through Virtualbox, as far as I know. So it would be strictly in the guest OS that you would troubleshoot the SMR drive.
krishpm
Posts: 4
Joined: 13. Mar 2020, 00:07

Re: Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by krishpm »

Thanks. I am able to add a regular drive (CMR) this way and format it and create ext4 filesystem using mkfs.ext4 command from the Linux guest.
But when I add SMR drive using the same mechanism,and run dmzadm command to format the drive, it does not work.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Formatting SMR drives from Ubuntu 18.04 guest on Windows host

Post by scottgus1 »

So a raw-disk regular drive works but a raw-disk SMR drive does not. While there is a slight possibility Virtualbox might be getting in the way, the only way to test would be to attach the SMR drive directly to a real PC running the VM's flavor and update-level of Linux installed on the bare metal. If the physical Linux can handle the SMR drive, but the equal-version-and-updates Linux VM cannot, then Virtualbox is interfering.

Also there is another path to search:
scottgus1 wrote:Per https://en.wikipedia.org/wiki/Shingled_ ... _recording:
Device-managed SMR devices hide this complexity by managing it in the firmware, presenting an interface like any other hard disk. Other SMR devices are host-managed and depend on the operating system to know how to handle the drive
Check that your Linux is set up to handle SMR drives, that you have apt-getted everything you need to apt-get.
Post Reply