在esx下使用U盘进行备份

原文:http://virtualrj.wordpress.com/2009/01/07/connecting-usb-hd-in-esx-for-back-up/

As the new year begun some servers were due to be moved to another place more permanent burial place. Our ‘expensive’ SAN storage space is too small to keep the old servers on it so it was time to move them to a USB harddisk. But I had no idea how I could attach it to the ESX. Well for those of you who want to know for the future here is how I did it.

Well first of all I hooked the USB drive onto the ESX server (HP Proliant DL380g5). When I logged onto the console the first thing I did was execute cat /var/log/messages. This gave me following lines:

kernel: Initializing USB Mass Storage driver...
kernel: usb.c: registered new driver usb-storage
kernel: scsi3 : SCSI emulation for USB Mass Storage devices
kernel: Vendor: WD Model: 10EAVS External Rev: 1.05
kernel: Type: Direct-Access ANSI SCSI revision: 02

And a couple of lines further:

kernel: VMWARE: Unique Device attached as scsi disk sdc at scsi3, channel 0, id 0, lun 0
kernel: Attached scsi disk sdc at scsi3, channel 0, id 0, lun 0
kernel: SCSI device sdc: 1953525168 512-byte hdwr sectors (1000205 MB)
kernel: sdc: sdc1
kernel: USB Mass Storage support registered.

From this information I concluded that the USB drive was recognised and was emulated as SCSI, hence the sdc. My harddrive already contained a NTFS partition, but ESX doesn’t have the NTFS drivers. Thats why it will mount the partition using FAT32. This would pose a problem because FAT32 doesn’t support files bigger as 4Gb and my vmdk’s are much bigger. So I decided to format the disk with EXT2 so I could move the files.

I first deleted all the existing partitions with fdisk and after that I created a new primary partition with partition type Linux. After formatting it with the command mke2fs /dev/sdc1 I had a working Linux partition. If you by any chance would want to have an EXT3 disk you could use mke2fs -j /dev/sdc1.

So now I got a working disk and a working partition. First I needed a mount point before I could actually mount the USB drive. So I made a directory in /mntcalled ‘usb’ with mkdir /mnt/usb and I executed the following command:

mount /dev/sdc1 /mnt/usb

Now I could access the disk at /mnt/usb and copy all the old VM’s from/vmfs/volumes/[datastorename]. If you want to copy entire directory’s make sure you use the '-R' parameter with cp.

posted @ 2011-05-04 13:25  swordzj  阅读(650)  评论(0编辑  收藏  举报