gem5-users@gem5.org

The gem5 Users mailing list

View all threads

increasing disk image size for full system simulation

CJ
Choe, Jiwon
Wed, Apr 22, 2020 4:21 PM

Hi all,

This might not be exactly gem5-related, but I was wondering if anyone on
this mailing list has done this before and could help me out.

I'm trying to increase the .img disk image size, and I thought I had made
some progress by using "qemu-img resize" and "parted" linux commands. But
when I try to use this image, I get an error saying: "EXT2-fs (sda1):
error: read_inode_bitmap: Cannot read inode bitmap".

When I run e2fsck on the image, I get the following message:
The filesystem size (according to the superblock) is 1048416 blocks
The physical size of the device is 524128 blocks
Either the superblock or the partition table is likely to be corrupt!

Has anyone successfully managed to increase a disk image size? Or would you
recommend that I just create a fresh new disk image with a larger size?

Thanks,
Jiwon

Hi all, This might not be exactly gem5-related, but I was wondering if anyone on this mailing list has done this before and could help me out. I'm trying to increase the .img disk image size, and I thought I had made some progress by using "qemu-img resize" and "parted" linux commands. But when I try to use this image, I get an error saying: "EXT2-fs (sda1): error: read_inode_bitmap: Cannot read inode bitmap". When I run e2fsck on the image, I get the following message: The filesystem size (according to the superblock) is 1048416 blocks The physical size of the device is 524128 blocks Either the superblock or the partition table is likely to be corrupt! Has anyone successfully managed to increase a disk image size? Or would you recommend that I just create a fresh new disk image with a larger size? Thanks, Jiwon
SG
Serhat Gesoglu
Wed, Apr 22, 2020 4:41 PM

Hi,
I am copying the instructions from my answer to another gem5 question to increase your disk image size: https://www.mail-archive.com/gem5-users(a)gem5.org/msg16495.html

fsck and its variations can be used on a partition, not on an entire image
file/disk.
Since you are using an image file, you need to create a loop device to run
e2fsck.

After increasing the disk size with:
$ dd if=/dev/zero bs=1M count=400 >>  linux-x86.img

Expand the first partition:
$ parted linux-x86.img resizepart 1 100%

The sector size and the boot start should be checked and noted down using:
$ fdisk -l linux-x86.img

sector size * boot start will give you the offset.

Using this offset and an available loop device number create a loop device:
$ losetup --offset  <sector size * boot start> /dev/loop<X> linux-x86.img

Resize the file system size:
$ resize2fs /dev/loop<X>

At this stage e2fsck can be used:
$ e2fsck -f /dev/loop<X>

You can also mount the device and copy your files.
$ mount -oloop /dev/loop<X> <mount_point>

I am afraid I haven't experienced the error you got. However, this link might be of help https://unix.stackexchange.com/questions/565923/either-the-superblock-or-the-partition-table-is-likely-to-be-corrupt-after-pa

Cheers
Serhat


From: Choe, Jiwon via gem5-users [gem5-users(a)gem5.org]
Sent: 22 April 2020 17:21
To: gem5 users mailing list
Cc: ofirgo(a)campus.technion.ac.il; Choe, Jiwon
Subject: [gem5-users] increasing disk image size for full system simulation

Hi all,

This might not be exactly gem5-related, but I was wondering if anyone on this mailing list has done this before and could help me out.

I'm trying to increase the .img disk image size, and I thought I had made some progress by using "qemu-img resize" and "parted" linux commands. But when I try to use this image, I get an error saying: "EXT2-fs (sda1): error: read_inode_bitmap: Cannot read inode bitmap".

When I run e2fsck on the image, I get the following message:
The filesystem size (according to the superblock) is 1048416 blocks
The physical size of the device is 524128 blocks
Either the superblock or the partition table is likely to be corrupt!

Has anyone successfully managed to increase a disk image size? Or would you recommend that I just create a fresh new disk image with a larger size?

Thanks,
Jiwon

Hi, I am copying the instructions from my answer to another gem5 question to increase your disk image size: https://www.mail-archive.com/gem5-users(a)gem5.org/msg16495.html fsck and its variations can be used on a partition, not on an entire image file/disk. Since you are using an image file, you need to create a loop device to run e2fsck. After increasing the disk size with: $ dd if=/dev/zero bs=1M count=400 >> linux-x86.img Expand the first partition: $ parted linux-x86.img resizepart 1 100% The sector size and the boot start should be checked and noted down using: $ fdisk -l linux-x86.img sector size * boot start will give you the offset. Using this offset and an available loop device number create a loop device: $ losetup --offset <sector size * boot start> /dev/loop<X> linux-x86.img Resize the file system size: $ resize2fs /dev/loop<X> At this stage e2fsck can be used: $ e2fsck -f /dev/loop<X> You can also mount the device and copy your files. $ mount -oloop /dev/loop<X> <mount_point> I am afraid I haven't experienced the error you got. However, this link might be of help https://unix.stackexchange.com/questions/565923/either-the-superblock-or-the-partition-table-is-likely-to-be-corrupt-after-pa Cheers Serhat ________________________________ From: Choe, Jiwon via gem5-users [gem5-users(a)gem5.org] Sent: 22 April 2020 17:21 To: gem5 users mailing list Cc: ofirgo(a)campus.technion.ac.il; Choe, Jiwon Subject: [gem5-users] increasing disk image size for full system simulation Hi all, This might not be exactly gem5-related, but I was wondering if anyone on this mailing list has done this before and could help me out. I'm trying to increase the .img disk image size, and I thought I had made some progress by using "qemu-img resize" and "parted" linux commands. But when I try to use this image, I get an error saying: "EXT2-fs (sda1): error: read_inode_bitmap: Cannot read inode bitmap". When I run e2fsck on the image, I get the following message: The filesystem size (according to the superblock) is 1048416 blocks The physical size of the device is 524128 blocks Either the superblock or the partition table is likely to be corrupt! Has anyone successfully managed to increase a disk image size? Or would you recommend that I just create a fresh new disk image with a larger size? Thanks, Jiwon
CS
Ciro Santilli
Wed, Apr 22, 2020 8:20 PM

Try libguestfs-tools:
https://askubuntu.com/questions/107228/how-to-resize-virtual-machine-disk/481887#481887

It is the easiest method. I think it boots QEMU, mounts the image, and
does the resizing operations for you.

You may need to add sudo to commands due to this bug:
https://askubuntu.com/questions/1046828/how-to-run-libguestfs-tools-tools-such-as-virt-make-fs-without-sudo

I've just tested it on a Ubuntu 19.10 host and Ubuntu 18.04 Ubuntu
server image after server setup mentioned at:
https://askubuntu.com/questions/884534/how-to-run-ubuntu-desktop-on-qemu/1046792#1046792
(replacing all qcow2 with raw)

On Wed, Apr 22, 2020 at 5:23 PM Choe, Jiwon via gem5-users
<gem5-users(a)gem5.org> wrote:

Hi all,

This might not be exactly gem5-related, but I was wondering if anyone on this mailing list has done this before and could help me out.

I'm trying to increase the .img disk image size, and I thought I had made some progress by using "qemu-img resize" and "parted" linux commands. But when I try to use this image, I get an error saying: "EXT2-fs (sda1): error: read_inode_bitmap: Cannot read inode bitmap".

When I run e2fsck on the image, I get the following message:
The filesystem size (according to the superblock) is 1048416 blocks
The physical size of the device is 524128 blocks
Either the superblock or the partition table is likely to be corrupt!

Has anyone successfully managed to increase a disk image size? Or would you recommend that I just create a fresh new disk image with a larger size?

Thanks,
Jiwon


gem5-users mailing list -- gem5-users(a)gem5.org
To unsubscribe send an email to gem5-users-leave(a)gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Try libguestfs-tools: https://askubuntu.com/questions/107228/how-to-resize-virtual-machine-disk/481887#481887 It is the easiest method. I think it boots QEMU, mounts the image, and does the resizing operations for you. You may need to add sudo to commands due to this bug: https://askubuntu.com/questions/1046828/how-to-run-libguestfs-tools-tools-such-as-virt-make-fs-without-sudo I've just tested it on a Ubuntu 19.10 host and Ubuntu 18.04 Ubuntu server image after server setup mentioned at: https://askubuntu.com/questions/884534/how-to-run-ubuntu-desktop-on-qemu/1046792#1046792 (replacing all qcow2 with raw) On Wed, Apr 22, 2020 at 5:23 PM Choe, Jiwon via gem5-users <gem5-users(a)gem5.org> wrote: > > Hi all, > > This might not be exactly gem5-related, but I was wondering if anyone on this mailing list has done this before and could help me out. > > I'm trying to increase the .img disk image size, and I thought I had made some progress by using "qemu-img resize" and "parted" linux commands. But when I try to use this image, I get an error saying: "EXT2-fs (sda1): error: read_inode_bitmap: Cannot read inode bitmap". > > When I run e2fsck on the image, I get the following message: > The filesystem size (according to the superblock) is 1048416 blocks > The physical size of the device is 524128 blocks > Either the superblock or the partition table is likely to be corrupt! > > Has anyone successfully managed to increase a disk image size? Or would you recommend that I just create a fresh new disk image with a larger size? > > Thanks, > Jiwon > _______________________________________________ > gem5-users mailing list -- gem5-users(a)gem5.org > To unsubscribe send an email to gem5-users-leave(a)gem5.org > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s