[Netkit.users] Resize Filesystem problem

Massimo Rimondini rimondin a dia.uniroma3.it
Ven 26 Gen 2007 12:33:15 CET


Dear Nicola,

I can provide a procedure that works for me.

=== STEP 1: Alter backing file size and partition table ===

brunello:~/TEST# dd if=/dev/zero of=netkit-fs-F2.2 bs=1 count=1 seek=2G
1+0 records in
1+0 records out
1 byte (1 B) copied, 5.6e-05 seconds, 17.9 kB/s
brunello:~/TEST# losetup -f netkit-fs-F2.2
brunello:~/TEST# losetup /dev/loop1
/dev/loop1: [0805]:1114194 (netkit-fs-F2.2)
brunello:~/TEST# fdisk /dev/loop1

Command (m for help): p

Disk /dev/loop1: 2147 MB, 2147483648 bytes
128 heads, 32 sectors/track, 1024 cylinders
Units = cylinders of 4096 * 512 = 2097152 bytes

      Device Boot      Start         End      Blocks   Id  System
/dev/loop1p1   *           1         300      614384   83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1024, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1024, default 1024):
Using default value 1024

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid 
argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
brunello:~/TEST# losetup -d /dev/loop1

=== STEP 2: Alter filesystem size ===

brunello:~/TEST# losetup -o 16384 -f netkit-fs-F2.2
brunello:~/TEST# losetup /dev/loop1
/dev/loop1: [0805]:1114194 (netkit-fs-F2.2), offset 16384
brunello:~/TEST# e2fsck -f /dev/loop1
e2fsck 1.39-WIP (09-Apr-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop1: 21997/76800 files (1.5% non-contiguous), 102736/153596 blocks
brunello:~/TEST# resize2fs /dev/loop1
resize2fs 1.39-WIP (09-Apr-2006)
Resizing the filesystem on /dev/loop1 to 524284 (4k) blocks.
The filesystem on /dev/loop1 is now 524284 blocks long.

brunello:~/TEST# e2fsck /dev/loop1
e2fsck 1.39-WIP (09-Apr-2006)
/dev/loop1: clean, 21997/245760 files, 108044/524284 blocks
brunello:~/TEST# losetup -d /dev/loop1



And then the machine starts cleanly with:
vstart pc1 -m netkit-fs-F2.2 --append=root=98:1

Regards,
Massimo.


Bertolucci Nicola wrote:

> Hi all
> I tried to resize filesystem like I read in your thread on December, 
> and exactaly like this:
> #dd if=/dev/zero of=netkit-fs-F2.2 bs=1 count=1 seek=4G conv=notrunc
> #losetup -o 16384 /dev/loop0 netkit-fs-F2.2
> #e2fsck -f /dev/loop0
> #resize2fs -p /dev/loop0
> #losetup -d /dev/loop0
>
> and when I start the vm i have:
>
>/INIT: version 2.86 booting
>/>/ Activating swap.
>/>/ Checking root file system...
>
>/>/ fsck 1.37 (21-Mar-2005)
>/>/ /dev/ubd/disc0/part1: The filesystem size (according to the 
>/>/ superblock) is 1048572 blocks
>/>/ The physical size of the device is 153596 blocks
>
>/>/ Either the superblock or the partition table is likely to be corrupt!
>/>/
>/>/
>/>/ /dev/ubd/disc0/part1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
>/>/         (
>i.e., without -a or -p options)
>/>/
>/>/ fsck failed.  Please repair manually and reboot.  Please note
>/>/ that the root file system is currently mounted read-only.  To
>/>/ remount it read-write:
>
>/>/
>/>/    # mount -n -o remount,rw /
>/>/
>/>/ CONTROL-D will exit from this shell and REBOOT the system.
>/>/
>/>/ Give root password for maintenance
>/
>>/ (or type Control-D to continue):/
>
> In your last mail you said me that the missing step is to update the 
> partition table inside
>
>netkit-fs-F2.2 with fdisk /dev/loop0,I tried to do tath and this time when I start the vm i have:
>
>
>
>EXT2-fs error (device ubda1): ext2_get_inode: unable to read inode block - inode
>=76815, block=163844
>INIT: version 2.86 booting
>Activating swap.
>Checking root file system...
>EXT2-fs error (device ubda1): ext2_get_inode: unable to read inode block - inode
>
>=76815, block=163844
>fsck 1.40-WIP (14-Nov-2006)
>/dev/ubd/disc0/part1: The filesystem size (according to the superblock) is 10485
>72 blocks
>The physical size of the device is 153596 blocks
>Either the superblock or the partition table is likely to be corrupt!
>
>
>
>/dev/ubd/disc0/part1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
>        (i.e., without -a or -p options)
>
>fsck failed.  Please repair manually and reboot.  Please note
>that the root file system is currently mounted read-only.  To
>
>remount it read-write:
>
>   # mount -n -o remount,rw /
>
>CONTROL-D will exit from this shell and REBOOT the system.
>
>  
>
> This is the same error, but it change the first line:
>
>EXT2-fs error (device ubda1): ext2_get_inode: unable to read inode block - inode
>=76815, block=163844
>
>
> When I tried to mount the fs,it's all ok,I can install all programs 
> that i want,i have update  & upgrade
>  but nothing to do,when I start the vm i receive the same error.
> Can you help me?
> Is there an another missing step or else?
> thanks for all
> Nicola
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Netkit.users mailing list
>Netkit.users a list.dia.uniroma3.it
>http://list.dia.uniroma3.it/mailman/listinfo/netkit.users
>  
>
-------------- parte successiva --------------
Un allegato HTML  stato rimosso...
URL: http://list.dia.uniroma3.it/mailman/private/netkit.users/attachments/20070126/127a416b/attachment.htm


Maggiori informazioni sulla lista Netkit.users