Difference between revisions of "Fs-images"

From Bashlinux
Jump to: navigation, search
(talk)
 
(Redirected page to Disk images)
 
Line 1: Line 1:
 
#REDIRECT [[Disk images]]
__NOTOC__
 
= Disk images =
 
== How to backup a whole HD ==
 
The byte size ''bs'' is useful to do a fast copy, specially then output location is remotly on a network
 
 
<pre><nowiki>
 
dd if=/dev/sda of=/path/to/store/disk.img bs=4096
 
</nowiki></pre>
 
 
 
To mount a partition from here, you have to consider that you have to ignore partition table.
 
 
<pre><nowiki>
 
mount -o loop,offset=32256 /path/to/store/disk.img /mnt/mydisk
 
</nowiki></pre>
 
 
 
== How to backup only one partition from a HD ==
 
 
<pre><nowiki>
 
dd if=/dev/sda1 of=/path/to/store/disk.img bs=4096
 
</nowiki></pre>
 
 
 
== How to convert a raw image from HD in a VMWare HD image ==
 
 
<pre><nowiki>
 
qemu-img convert -f raw /path/to/image/XPSP2.img -O vmdk /path/to/image/XPSP2.vmdk
 
</nowiki></pre>
 
 
 
== How to create a filesystem for CentOS 5 an older distros ==
 
One of the issues is grub is unable to read the filesystem, and must of the time is because the recent distros uses 256-byte node size.
 
In order to fix it, specially on VMs, do:
 
# Create the virtual drive as usual
 
 
<pre><nowiki>
 
# qemu-img create -f raw disk.img 20G
 
</nowiki></pre>
 
 
# boot using a knoppix image as cdrom
 
 
<pre><nowiki>
 
# qemu-system-x86_64 -m1024 -hda disk.img -cdrom knoppix.iso -boot d
 
</nowiki></pre>
 
 
# On knoppix prompt, type ''knoppix 3'', in order to boot in init level 3
 
# From the shell, start cfdisk and add only one linux partition.
 
# Create the filesyste in the created partition with 128-byte node size
 
 
<pre><nowiki>
 
# mkfs.ext3 -I 128 /dev/sda1
 
</nowiki></pre>
 
 
# Turn off the virtual machine
 
# Now, you can mount the drive as a real physical disk with
 
 
<pre><nowiki>
 
# mkdir disk
 
# mount -o loop,offset=32256 disk.img disk/
 
</nowiki></pre>
 

Latest revision as of 05:19, 12 June 2015

Redirect to: