[CentOS] Assign external esata drive to KVM

Sun Oct 21 10:37:49 UTC 2012
Giorgio Bersano <giorgio.bersano at gmail.com>

2012/10/20 Kanwar Ranbir Sandhu <m3freak at thesandhufamily.ca>

> Hello Everyone,
>
> I have a CentOS 6.3 host running a few KVMs.  One of them is a CentOS
> 6.3 KVM that I want to use for making backups with BackupPC.  What I'm
> having a problem with is assigning the KVM an external drive.
>
> I used to run BackupPC on an Ubuntu box. The backups went to an external
> eSATA 1.5TB, ext4 format, single partition drive (regular 3.5" in an
> enclosure).  I want to now attach that same external drive to my KVM
> host, and pass it up to the KVM running BackupPC.
>
> I added the entire drive as a second storage disk to the KVM. I used the
> disk's label (/dev/disk/by-label/backups) so that I wouldn't have to
> worry about the device name changing down the road.  When I booted up
> the KVM and listed the disks, I only saw "/dev/vdb". I was also
> expecting to see "/dev/vdb1".
>
> I ran fdisk on it only to see the partition table wasn't detected.  The
> drive itself is OK - I can mount it successfully on the KVM host.
> Here's the fdisk output:
>
> Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
> disklabel
> Building a new DOS disklabel with disk identifier 0xd6912a1b.
> Changes will remain in memory only, until you decide to write them.
> After that, of course, the previous content won't be recoverable.
>
> Warning: invalid flag 0x0000 of partition table 4 will be corrected by
> w(rite)
>
> WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
>          switch off the mode (command 'c') and change display units to
>          sectors (command 'u').
>
> Command (m for help): p
>
> Disk /dev/vdb: 1500.3 GB, 1500300861440 bytes
> 16 heads, 63 sectors/track, 2907018 cylinders
> Units = cylinders of 1008 * 512 = 516096 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0xd6912a1b
>
>    Device Boot      Start         End      Blocks   Id  System
>
> Command (m for help): quit
>
>
> So...how do I properly assign this eSATA disk to the KVM?  FYI: the
> enclosure can use USB as well.
>
> Thanks,
>
> Ranbir
>
>
>
Hi Ranbir,
please post the relevant configuration items from the guest's xml
definition and the output of fdisk when done on the host.