Eucalyptus: Die Größe von Images ändern (Variante 2)

[ 1 ] Juni 17, 2010 |

Dieser Artikel beschreibt das Ändern der Größe eines bereits vorhandenen Images.

Situation: Aktuell befindet sich ein Image mit dem Namen “old.img” in der Cloud und wird dort verwendet. Es wird aber ein 4 Gigabyte großes Image benötigt.

Zunächst wird Speicherplatz für das neue Image erstellt.

dd if=/dev/zero of=new.img bs=1M count=4096

Anschließend werden temporäre Mountpoints erstellt.

mkdir old
mkdir new

Dem alten und neuen Image wird jeweils ein Block Loop Device (z.B. loop0 und loop1) zugewiesen.

losetup /dev/loop0 old.img
losetup /dev/loop1 new.img

Auf dem neuen Image wird ein Dateisystem erstellt.

mke2fs -j /dev/loop1

Die Images werden gemounted.

mount /dev/loop0 old
mount /dev/loop1 new

Das neue Image wird befüllt.

(cd old; tar czf - .)|(cd new; tar xzf -)

Die Images werden wieder unmounted.

umount /dev/loop0
umount /dev/loop1

Die Block Loop Devices werden wieder freigegeben.

losetup -d /dev/loop0
losetup -d /dev/loop1

In dem neuen Image “new.img” befindet sich nun eine Replizierung des alten Images “old.img”. Allerdings mit der neuen Größe von 4 Gigabyte. Das Image “new.img” kann nun in die Cloud hochgeladen, registriert und genutz werden.

Achtung!!! Es sollte vorab sichergestellt werden, dass die Root Partition der verwendeten Instanz groß genug ist um das neue Image zu benutzen.

Quelle

Tags: , , ,

Category: Tutorials

About the Author ()

Rene Buest is Principal Analyst and Senior Advisor at renebuest research, covering cloud computing, business technology and collaboration. He is member of the GigaOm Pro Analyst Network and top cloud computing blogger in Germany. Worldwide he is one of the top 50 bloggers in this area. For more than 16 years he is focused on the strategic use of information technology in businesses and the IT impact on our society as well as disruptive technologies. Rene Buest is the author of numerous professional cloud computing and technology articles, speaker and participant of experts rounds. On CloudUser.de he writes about topics from the fields of cloud computing, it-infrastructures, technologies, management and strategies and is moving on Twitter via his account @ReneBuest. Rene Buest is organizer of numerous cloud computing and technology events. Covering the CloudCamp Hamburg 2010, CloudCamp Frankfurt 2012, CloudOps Summit 2012 and the Amazon Web Services and Windows Azure User Groups in Germany. Rene Buest is a fully qualified specialist for system integration und holds a diploma in computer engineering from the Hochschule Bremen (Dipl.-Informatiker (FH)) as well as a M.Sc. in IT-Management and Information Systems from the FHDW Paderborn. Detailed curriculum vitaes are hosted on XING and LinkedIn.

Leave a Reply

You must be logged in to post a comment.