[ubuntu-cloud] size of uec images

Kees Cook kees at ubuntu.com
Thu Oct 8 19:18:39 BST 2009


Hi,

On Thu, Oct 08, 2009 at 08:55:26AM -0400, Scott Moser wrote:
> On Thu, 8 Oct 2009, Soren Hansen wrote:
> 
> > On Wed, Oct 07, 2009 at 11:35:58PM -0400, Scott Moser wrote:
> > > Essentially, something like:
> > >    truncate "--size=$new_size" "$new_image"
> > >    mke2fs -j $new_image
> > >    sudo mount -o loop,ro "${old_image}" /mnt/tmp1
> > >    sudo mount -o loop "${new_image}" /mnt/tmp2
> > >    rsync -a /mnt/tmp1/ /mnt/tmp2
> > >    sudo umount /mnt/tmp1
> > >    sudo umount /mnt/tmp2
> >
> > Why not just:
> >   truncate --size="${new_size}" "${img}"
> >   resize2fs "${img}"
> 
> The advantage was really in the making of a new filesystem in the 10G
> image versus resizing the 2G up to 10.  I was afraid that actual use of a
> 2G fs resized to 10G might run out of inodes.  Entirely guesswork on my
> part.

For the record, ext2/3/4 resizing adds both inodes and blocks:

$ dd if=/dev/zero of=test.img bs=1 seek=1G count=0
$ mkfs.ext4 test.img
...
65536 inodes, 262144 blocks
...
$ resize2fs test.img 4G
...
$ debugfs test.img
debugfs 1.41.9 (22-Aug-2009)
debugfs:  stats
...
Inode count:              262144
Block count:              1048576
...

-Kees

-- 
Kees Cook
Ubuntu Security Team



More information about the Ubuntu-cloud mailing list