Filesystem Images

Aus Primatenwiki
Zur Navigation springen Zur Suche springen

Copy the entire content from one fs to another

Create an empty 10Gb image file:

# dd if=/dev/zero of=/path/to/newImgFile bs=1k count=10485760

Create an ext3 filesystem on the image:

# mke2fs -j /path/to/newImgFile

When you get the warning about the file not being a block special file, just answer yes to proceed.

Mount the current image file and the new one

# mount -o loop /path/to/currentImgFile /path/to/currentMntPoint
# mount -o loop /path/to/newImgFile /path/to/newMntPoint

Copy all the content of the current filesystem to the new one preserving permissions

# cd /path/to/currentMntPoint
# tar cf - . | tar xfp - -C /path/to/newMntPoint