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@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@gem5.org]
Sent: 22 April 2020 17:21
To: gem5 users mailing list
Cc: ofi...@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
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to