Re: restore hdd image to a bigger disk

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



On 08/24/2010 11:44 PM, Tavian Barnes wrote:
> On 24 August 2010 16:02, Mauro Santos <registo.mailling@xxxxxxxxx> wrote:
>> On 08/24/2010 10:20 PM, Marek Otahal wrote:
>>> On Tuesday 24 of August 2010 23:03:23 Mauro Santos wrote:
>>>> On 08/24/2010 08:14 PM, Marek Otahal wrote:
>>>>> Hi all,
>>>>>
>>>>> I use dd command to make an image of entire /dev/sda (160GB) and back up
>>>>> it as netobook.hdd to an external storage. The disk contains both
>>>>> encrypted(dmcrypt/luks) and normal linux/win partitions.
>>>>>
>>>>> My question is, if my netbook died and I needed to recover from backup,
>>>>> can I just dd-copy the image to a new larger disk? Does it matter?
>>>>>
>>>>> 1/ it will do, but the size will remain 160gb ..is ok.
>>>>> 2/ will do & possibility to resize partitions later ..even better! :)
>>>>>
>>>>> I've searched the net, but I'd like someone to confirm it 100% works
>>>>> (just dd and reboot).
>>>>>
>>>>> Thanks in advance, Marek
>>>>
>>>> Most probably you don't even need to copy the image back to a disk to
>>>> get the files you need. I don't know about the encrypted(dmcrypt/luks)
>>>> partitions but the "normal" linux/win partitions can be accessed
>>>> directly from the image.
>>>
>>> Is that so? I like the restore to a functional computer ability, so copying
>>> seems useful. But I was wondering how to mount a specific partition from an
>>> image? (i make the image of whole /dev/sda, so sda1,2,..are hidden inside)
>>>
>>> greetings, Marek
>>
>> Usually I do it like this:
>> - mount (?) the image to a loop device
>> losetup /dev/loop0 /path/to/image/file
>>
>> - get the start of partitions
>> parted /dev/loop0 unit B print
>>
>> take notice of the starting bytes for the partition you want to mount
>> mount /dev/loop0 mnt_point -o offset=start_bytes
>>
>> and thats it, you should be able to access at least the "normal"
>> partitions (read and write). I have never tried with encrypted
>> partitions, I guess you would have to pass some extra options to mount.
>>
>> To unmount everything cleanly do:
>> umount mnt_point
>> losetup -d /dev/loop0
>>
>> --
>> Mauro Santos
>>
> 
> But why?  The loop module supports partitions now, just modprobe it
> with max_part=10 or something.  The partitions will be
> /dev/loop0p[1234...].
> 

Nice tip. I've been using this method for quite a while so either it
wasn't available when I started using it or I missed the fact that the
module option is needed for this to work.

-- 
Mauro Santos


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux