[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: KVM image



On Sunday, 06 March 2011 20:18:10 +0700,
Sthu Deus wrote:

> Good time of the day.

Hi, Sthu.

> I can not mount a KVM HDD file - in the VM I create partition on the
> VM device, format it, latter I can access it in KVM.
> 
> But when I try to mount the file in host environment (not VM) it
> requires FS type, when it is specified, it gives usual error - bad SB,
> mount option, etc.
> 
> That's how I do it (and months ago it did work perfectly):
> 
> # mount -t ext3 -o loop,offset=32256 ./db /mnt/0
> 
> # ls
> da  db
> 
> the versions of KVM and related software is Debian 6 up to the date.

With raw devices I have not had problems with Debian 6.0:


ss01:~# fdisk -l /dev/vms/debian-test4

Disco /dev/vms/debian-test4: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 131072 bytes
Disk identifier: 0x000b7998

              Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/vms/debian-test4p1               1         122      979933+  82  Linux swap / Solaris
Partition 1 does not start on physical sector boundary.
/dev/vms/debian-test4p2             123        1305     9502447+  83  Linux
Partition 2 does not start on physical sector boundary.


ss01:~# losetup /dev/loop
loop0  loop1  loop2  loop3  loop4  loop5  loop6  loop7
ss01:~# losetup /dev/loop0 /dev/vms/debian-test4


ss01:~# losetup -a
/dev/loop0: [0005]:5012 (/dev/mapper/vms-debian--test4)


ss01:~# fdisk -l /dev/loop0

Disco /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b7998

   Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/loop0p1               1         122      979933+  82  Linux swap / Solaris
/dev/loop0p2             123        1305     9502447+  83  Linux


ss01:~# parted /dev/loop0
GNU Parted 2.3
Using /dev/loop0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit
Unit?  [compact]? B
(parted) print
Model:  (file)
Disk /dev/loop0: 10737418240B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start        End           Size         Type     File system     Flags
 1      32256B       1003484159B   1003451904B  primary  linux-swap(v1)
 2      1003484160B  10733990399B  9730506240B  primary  ext3

(parted)


ss01:~# mount -o offset=1003484160 /dev/loop0 /mnt/


ss01:~# mount | grep loop
/dev/loop1 on /mnt type ext3 (rw,offset=1003484160)


ss01:~# df -h | grep loop
/dev/loop1            9,0G  927M  7,6G  11% /mnt


ss01:~# cd /mnt/
ss01:/mnt# ll
total 100
drwxr-xr-x  2 root root  4096 ene 15 10:11 bin
drwxr-xr-x  3 root root  4096 ene 15 10:12 boot
lrwxrwxrwx  1 root root    11 ago 14  2010 cdrom -> media/cdrom
drwxr-xr-x  4 root root  4096 ago 14  2010 dev
drwxr-xr-x  3 root root  4096 ago 14  2010 emul
drwxr-xr-x 58 root root  4096 ene 16 11:25 etc
drwxr-xr-x  3 root root  4096 ago 14  2010 home
lrwxrwxrwx  1 root root    30 ago 14  2010 initrd.img -> boot/initrd.img-2.6.26-2-amd64
lrwxrwxrwx  1 root root    30 ago 14  2010 initrd.img.old -> boot/initrd.img-2.6.26-1-amd64
drwxr-xr-x 11 root root 12288 ene 15 10:10 lib
lrwxrwxrwx  1 root root    20 ago 14  2010 lib32 -> /emul/ia32-linux/lib
lrwxrwxrwx  1 root root     4 ago 14  2010 lib64 -> /lib
drwx------  2 root root 16384 ago 14  2010 lost+found
drwxr-xr-x  3 root root  4096 ago 14  2010 media
drwxr-xr-x  2 root root  4096 dic  4  2008 mnt
drwxr-xr-x  2 root root  4096 ago 14  2010 opt
drwxr-xr-x  2 root root  4096 dic  4  2008 proc
drwxr-xr-x  5 root root  4096 ene 15 11:14 root
drwxr-xr-x  2 root root  4096 ene 15 10:22 sbin
drwxr-xr-x  2 root root  4096 sep 16  2008 selinux
drwxr-xr-x  2 root root  4096 ago 14  2010 srv
drwxr-xr-x  2 root root  4096 ago 12  2008 sys
drwxrwxrwt  4 root root  4096 ene 16 11:08 tmp
drwxr-xr-x 11 root root  4096 ago 15  2010 usr
drwxr-xr-x 14 root root  4096 ene 15 11:37 var
lrwxrwxrwx  1 root root    27 ago 14  2010 vmlinuz -> boot/vmlinuz-2.6.26-2-amd64
lrwxrwxrwx  1 root root    27 ago 14  2010 vmlinuz.old -> boot/vmlinuz-2.6.26-1-amd64





Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598

Attachment: signature.asc
Description: Digital signature


Reply to: