Web lists-archives.com

Re: Restore backup to KVM




	Hi.

On Tue, Sep 26, 2017 at 09:44:57PM +0200, solitone wrote:
> On 26/09/17 17:31, Reco wrote:
> > > On 26/09/17 13:01, solitone wrote:
> > > > It's strange, since it finds /dev/sda, i.e. the entire disk:
> > > > 
> > > > =========================================================
> > > > [    6.438693] sd 0:0:0:0: [sda] 188743680 512-byte logical blocks:
> > > > (96.6 GB/90.0 GiB)
> > > > [    6.469182] sd 0:0:0:0: [sda] Write Protect is off
> > > > [    6.482421] sd 0:0:0:0: [sda] Write cache: enabled, read cache:
> > > > enabled, doesn't support DPO or FUA
> > > > =========================================================
> > > > 
> > > > However, it then complains that /dev/sda1 does not exists
> > 
> > That's because you don't have any partitions on that disk. Partition
> > that's start with sector 0 is impossible.
> 
> Interesting. I used parted to create one single partition as big as the
> entire file. Here's what parted shows now:
> 
> =========================================================
> $ /sbin/parted  alan_restore.img
> WARNING: You are not superuser.  Watch out for permissions.
> GNU Parted 3.2
> Using /media/solitone/Maxtor/vmimages/alan_restore.img
> Welcome to GNU Parted! Type 'help' to view a list of commands.
> 
> (parted) p
> Model:  (file)
> Disk /media/solitone/Maxtor/vmimages/alan_restore.img: 96.6GB
> Sector size (logical/physical): 512B/512B
> Partition Table: loop
> Disk Flags:
> 
> Number  Start  End     Size    File system  Flags
>  1      0.00B  96.6GB  96.6GB  ext4
> =========================================================
> 
> I assumed that that number 1 referred to partition n. 1, but I must be
> mistaken.

I'm curious to know how you'd achieve this. Because best I could produce
is this:

$ dd if=/dev/zero of=restore.img bs=1M count=0 seek=96K
0+0 records in
0+0 records out
0 bytes copied, 0.000490565 s, 0.0 kB/s

$ /sbin/parted restore.img
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 3.2
Using /tmp/restore.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos
(parted) mkpart primary 0 -1
Warning: The resulting partition is not properly aligned for best
performance.
Ignore/Cancel? I
(parted) print
Model:  (file)
Disk /tmp/restore.img: 103GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End    Size   Type     File system  Flags
 1      512B   103GB  103GB  primary               lba

Note the difference at 'Partition Table' and 'Start'.

Reco