qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] qemu-nbd or qcow2 or something else ?


From: Pascal
Subject: Re: [Qemu-discuss] qemu-nbd or qcow2 or something else ?
Date: Fri, 1 Dec 2017 21:12:05 +0100

I just finished the same test on raw images (with losetup instead of
qemu-nbd) and the problem does not occur in this case.
(ntfsfix is - must be - used with the -n option to not alter the checked
partitions)

2017-12-01 18:56 GMT+01:00 Pascal <address@hidden>:

> hello,
>
> while doing some tests on the ntfs file system, I met some strange things
> with my qcow2 disk images.
> the images are on a partition mounted in tmpfs, but the result is the same
> when they are recorded on a partition in ext4 format.
> I don't know where the problem comes from : qemu-nbd or format qcow2 or
> something else ?
> do not hesitate if you want more informations.
>
> # uname -a
> Linux archlive 4.9.65-1-lts #1 SMP Fri Nov 24 13:02:16 CET 2017 x86_64
> GNU/Linux
>
> # modprobe nbd max_part=16
>
> # journalctl | tail
> ...
> déc. 01 17:11:04 archlive kernel: nbd: registered device at major 43
> déc. 01 17:11:10 archlive kernel: nbd: unregistered device at major 43
> déc. 01 17:11:19 archlive kernel: nbd: registered device at major 43
>
> # mount | grep /tmp
> tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
>
> # qemu-img -V
> qemu-img version 2.10.1
> Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
>
> # qemu-img create -f qcow2 /tmp/a.img 2G
> Formatting '/tmp/a.img', fmt=qcow2 size=2147483648 <(214)%20748-3648>
> cluster_size=65536 lazy_refcounts=off refcount_bits=16
>
> # qemu-img create -f qcow2 /tmp/b.img 2G
> Formatting '/tmp/b.img', fmt=qcow2 size=2147483648 <(214)%20748-3648>
> cluster_size=65536 lazy_refcounts=off refcount_bits=16
>
> # qemu-nbd -V
> qemu-nbd 2.10.1
> Written by Anthony Liguori.
> Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> # qemu-nbd -f qcow2 -c /dev/nbd0 /tmp/a.img
>
> # qemu-nbd -f qcow2 -c /dev/nbd1 /tmp/b.img
>
> # fdisk /dev/nbd0
> Bienvenue dans fdisk (util-linux 2.31).
> ...
> Appel d'ioctl() pour relire la table de partitions.
> Synchronisation des disques.
>
> # fdisk -l /dev/nbd0
> Disque /dev/nbd0 : 2 GiB, 2147483648 <(214)%20748-3648> octets,
> 4194304 secteurs
> Unités : secteur de 1 × 512 = 512 octets
> Taille de secteur (logique / physique) : 512 octets / 512 octets
> taille d'E/S (minimale / optimale) : 512 octets / 512 octets
> Type d'étiquette de disque : dos
> Identifiant de disque : 0x5267176c
> Périphérique Amorçage Début     Fin Secteurs Taille Id Type
> /dev/nbd0p1            2048 4194303  4192256     2G  7 HPFS/NTFS/exFAT
>
> # mkfs.ntfs /dev/nbd0p1
> The partition start sector was not specified for /dev/nbd0p1 and it could
> not be obtained automatically.  It has been set to 0.
> The number of sectors per track was not specified for /dev/nbd0p1 and it
> could not be obtained automatically.  It has been set to 0.
> The number of heads was not specified for /dev/nbd0p1 and it could not be
> obtained automatically.  It has been set to 0.
> Cluster size has been automatically set to 4096 bytes.
> To boot from a device, Windows needs the 'partition start sector', the
> 'sectors per track' and the 'number of heads' to be set.
> Windows will not be able to boot from this device.
> Initializing device with zeroes: 100% - Done.
> Creating NTFS volume structures.
> mkntfs completed successfully. Have a nice day.
>
> # ntfsfix /dev/nbd0p1
> Mounting volume... OK
> Processing of $MFT and $MFTMirr completed successfully.
> Checking the alternate boot sector... OK
> NTFS volume version is 3.1.
> NTFS partition /dev/nbd0p1 was processed successfully.
>
> # file -s /dev/nbd0p1
> /dev/nbd0p1: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS    ",
> sectors/cluster 8, Media descriptor 0xf8, sectors/track 0, dos < 4.0
> BootSector (0x80), FAT (1Y bit by descriptor); NTFS, sectors 4192255, $MFT
> start cluster 4, $MFTMirror start cluster 262015, bytes/RecordSegment
> 2^(-1*246), clusters/index block 1, serial number 0a7b496524076a6f
>
> # fdisk -l /dev/nbd1
> Disque /dev/nbd1 : 2 GiB, 2147483648 <(214)%20748-3648> octets,
> 4194304 secteurs
> Unités : secteur de 1 × 512 = 512 octets
> Taille de secteur (logique / physique) : 512 octets / 512 octets
> taille d'E/S (minimale / optimale) : 512 octets / 512 octets
>
> # cat /dev/nbd0 > /dev/nbd1
>
> # blockdev --rereadpt /dev/nbd1
>
> # fdisk -l /dev/nbd1
> Disque /dev/nbd1 : 2 GiB, 2147483648 <(214)%20748-3648> octets,
> 4194304 secteurs
> Unités : secteur de 1 × 512 = 512 octets
> Taille de secteur (logique / physique) : 512 octets / 512 octets
> taille d'E/S (minimale / optimale) : 512 octets / 512 octets
> Type d'étiquette de disque : dos
> Identifiant de disque : 0x5267176c
> Périphérique Amorçage Début     Fin Secteurs Taille Id Type
> /dev/nbd1p1            2048 4194303  4192256     2G  7 HPFS/NTFS/exFAT
>
> # ntfsfix /dev/nbd1p1
> Mounting volume... NTFS signature is missing.
> FAILED
> Attempting to correct errors... NTFS signature is missing.
> FAILED
> Failed to startup volume: Invalid argument
> NTFS signature is missing.
> Trying the alternate boot sector
> Unrecoverable error
> Volume is corrupt. You should run chkdsk.
>
> # file -s /dev/nbd1p1
> /dev/nbd1p1: data
>
> # sha1sum /dev/nbd0 /dev/nbd1
> b496b014d1d65fba12b29990b6ea5c53612ade47  /dev/nbd0
> b496b014d1d65fba12b29990b6ea5c53612ade47  /dev/nbd1
>
> # sha1sum /dev/nbd0p1 /dev/nbd1p1
> 36abea5b0bf1988cbd80490cbcac0ee278164b66  /dev/nbd0p1
> 2996ef6a8af8b8e42d8af52a2519389a565bece1  /dev/nbd1p1
>
> # ll /tmp/*.img
> -rw-r--r-- 1 root root 2147024896 <(214)%20702-4896>  1 déc.  17:24
> /tmp/a.img
> -rw-r--r-- 1 root root 2148139008 <(214)%20813-9008>  1 déc.  17:27
> /tmp/b.img
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]