WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Trouble getting resize2fs to work correctly.  (Read 6164 times)

Offline neophyte

  • Newbie
  • *
  • Posts: 11
Trouble getting resize2fs to work correctly.
« on: October 03, 2015, 01:21:02 PM »
Greetings,

I've been following the instructions in the README file and run into an issue. I've resized my second partition, mmcblk0p2, to the full size of the card but resize2fs isn't resizing it up to that size.

 Before resizing, the partition started on cylinder 49152 and ended on 104447. The df utility says that there is 25.1 megabytes total for this partition. I followed the instructions and used fdisk to delete the second partition and recreate another primary partition on cylinder 49152 and ended it on cylinder 30898175 which is as large as you can get on this microSD card. I rebooted and went to resize the filesystem. After running resize2fs on mmcblk0p2 I get a total size of 30.1 megabytes, far short of the roughly 16 gigs of space on this card.

I've checked fdisk again and it says that the partition is still definitely ending on cylinder 30898175. I've checked dmesg and it says:
Code: [Select]
EXT4-fs (mmcblk0p2): resizing filesystem from 27648 to 15424512 blocks
[   69.404444] ------------[ cut here ]------------
[   69.404526] WARNING: CPU: 0 PID: 2481 at fs/jbd2/transaction.c:269 start_this_handle+0x5f0/0x694()
[   69.404543] Modules linked in: i2c_dev spi_bcm2708 i2c_bcm2708 evdev uio_pdrv_genirq uio
[   69.404597] CPU: 0 PID: 2481 Comm: resize2fs Not tainted 3.18.10-piCore+ #1
[   69.404665] [<c001550c>] (unwind_backtrace) from [<c00129e8>] (show_stack+0x20/0x24)
[   69.404765] [<c00129e8>] (show_stack) from [<c0564bbc>] (dump_stack+0x20/0x28)
[   69.404809] [<c0564bbc>] (dump_stack) from [<c0023150>] (warn_slowpath_common+0x7c/0x9c)
[   69.404847] [<c0023150>] (warn_slowpath_common) from [<c002322c>] (warn_slowpath_null+0x2c/0x34)
[   69.404882] [<c002322c>] (warn_slowpath_null) from [<c0211320>] (start_this_handle+0x5f0/0x694)
[   69.404917] [<c0211320>] (start_this_handle) from [<c02117f0>] (jbd2__journal_start+0xf8/0x20c)
[   69.404969] [<c02117f0>] (jbd2__journal_start) from [<c01f7cd4>] (__ext4_journal_start_sb+0x68/0xf8)
[   69.405073] [<c01f7cd4>] (__ext4_journal_start_sb) from [<c01eb7b4>] (ext4_flex_group_add+0x550/0x1b44)
[   69.405149] [<c01eb7b4>] (ext4_flex_group_add) from [<c01ee1dc>] (ext4_resize_fs+0x8f4/0xf88)
[   69.405185] [<c01ee1dc>] (ext4_resize_fs) from [<c01d14b4>] (ext4_ioctl+0x128/0x10a8)
[   69.405222] [<c01d14b4>] (ext4_ioctl) from [<c0150868>] (do_vfs_ioctl+0x40c/0x5e4)
[   69.405251] [<c0150868>] (do_vfs_ioctl) from [<c0150a84>] (SyS_ioctl+0x44/0x6c)
[   69.405284] [<c0150a84>] (SyS_ioctl) from [<c000eb60>] (ret_fast_syscall+0x0/0x48)
[   69.405301] ---[ end trace d5c64d244b071e6f ]---
[   69.405319] JBD2: resize2fs wants too many credits (155 > 128)
[   69.405352] EXT4-fs (mmcblk0p2): resized filesystem to 15424512

Not really sure where to go from here. I'm on the version 6.1-X image. Using an old Raspberry pi Model B+.

Offline jncl

  • Newbie
  • *
  • Posts: 38
Re: Trouble getting resize2fs to work correctly.
« Reply #1 on: October 04, 2015, 06:32:33 AM »
Hi,

    The way I get the second partition resized is as follows:

    1. Get the start cylinder of the second partition:
Code: [Select]
SCYL=$(sudo fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{ print $2 }')
   2. Using the value returned in step 1, use the following command to change it:
Code: [Select]
echo -e "p\nd\n2\nn\np\n2\n${SCYL}\n\n\np\nw\n" | sudo fdisk /dev/mmcblk0
      The string is broken down as follows (\n is a newline character, i.e. <enter>):
      p - print partition table
      d - delete partition
      2 - partition number
      n - new partition
      p - primary partition
      2 - partition number
      ${SCYL} - start cylinder
      <enter> - last cylinder (accept default)
      p - print partition table to check
      w - write table to disk and exit

    3.  Then reboot the Pi:
Code: [Select]
sudo reboot
    4. Then run the resize program:
Code: [Select]
sudo resize2fs /dev/mmcblk0p2
HTH

  Jncl
 

Offline neophyte

  • Newbie
  • *
  • Posts: 11
Re: Trouble getting resize2fs to work correctly.
« Reply #2 on: October 05, 2015, 08:48:28 PM »
Thank you for the reply jncl. I used your shell script to speed things up but got the same result.

I found what I think is an error in how the 6.1 image is created. I went back a version to 6.0-X and I was able to successfully extend the mmcblk0p2 partition to the full size of the sd card. On 6.0-X the amount of used space on mmcblk0p2 is initially around 11 MB. On 6.1-X it is around 21 MB which seems rather large. When I check the size of the partitions on mmcblk0 with fdisk I get a warning that partition 1 doesn't end on a cylinder boundary with the 6.1 image, but I don't get this warning with 6.0.

So that is the extent of my detective work so far. It is definitely some kind of error in how the 6.1-X image was generated. I don't know enough on how to fix this so for now I'm using the 6.0-X image until 7.0-X image is released.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Trouble getting resize2fs to work correctly.
« Reply #3 on: October 05, 2015, 10:50:31 PM »
hi neophyte,

What is the result of fdisk -l /dev/mmcblk0?

IIRC there was a version of piCore with funny head and sector settings. Heads = 3 and I can't remember the number of sectors.

I used this code to reconstruct both partitions (deletion of partitions not shown). Note the -H 4 -S16 options.

Code: [Select]
fdisk -H 4 -S 16 /dev/sda <<EOF
p
n
p
1
33
832
t
c
n
p
2
833
+50M
p
w
EOF

regards
Greg

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Trouble getting resize2fs to work correctly.
« Reply #4 on: October 06, 2015, 01:03:53 AM »
I don't know enough on how to fix this so for now I'm using the 6.0-X image until 7.0-X image is released.

You can try 7.0 easily. Just install the latest SSH test version, resize the partition and install TC.tcz from repo. It will install the GUI environment, same as the usual X image.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Trouble getting resize2fs to work correctly.
« Reply #5 on: October 06, 2015, 01:11:13 AM »
You can safely ignore the cylinder boundary warning, it has no any practical meaning, just a relic from the past.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline neophyte

  • Newbie
  • *
  • Posts: 11
Re: Trouble getting resize2fs to work correctly.
« Reply #6 on: October 06, 2015, 05:35:26 AM »
@Greg Erskine

The head and sector are 2 and 8 for the 6.0 image that works. For the 6.1 image that doesn't they are at 4 and 16.

@bmarkus

Unfortunately, I don't have any wired internet connection. Only wireless. Unless there is a way to SSH into it via. wireless I can't really try out the test release.

Offline jncl

  • Newbie
  • *
  • Posts: 38
Re: Trouble getting resize2fs to work correctly.
« Reply #7 on: October 06, 2015, 09:56:35 AM »
Hi neophyte,

  I've just tried putting the 6.1-X image onto a 16GB MicroSD card and running disk.

  This is the output from the command:
Code: [Select]
The number of cylinders for this disk is set to 486192.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1             129         768       20480   c Win95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary
/dev/mmcblk0p2             769        1632      27648  83 Linux
Partition 2 does not end on cylinder boundary

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

Command (m for help): Command (m for help):
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1             129         768       20480   c Win95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary
/dev/mmcblk0p2             769      486192    15533568  83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy

Looking at this the ending cylinder is 486192, you said in the OP that your ending cylinder was 30898175, that seems very large to me. You also said that the starting cylinder was 49152 which again seems very high to me as mine is 769.

Can you post the output of fdisk -l /dev/mmcblk0 please?

  Jon
« Last Edit: October 06, 2015, 10:17:17 AM by jncl »

Offline jncl

  • Newbie
  • *
  • Posts: 38
Re: Trouble getting resize2fs to work correctly.
« Reply #8 on: October 06, 2015, 11:13:51 AM »
Hi neophyte,

  I subsequently noticed that if you run the command fdisk -lu that the values appear higher as they are being displayed in sectors as opposed to cylinders. So my previous comments about the values being high are irrelevant.

  I successfully built a 6.1-X image and ran the fdisk command but after a reboot I'm unable to resize the second partition, it fails with the message: resize2fs: No space left on device While checking for on-line resizing support and looking at the dmesg output I get a similar set of trace messages to those in your OP.

  I will investigate further and report back.

Jon

Offline jncl

  • Newbie
  • *
  • Posts: 38
Re: Trouble getting resize2fs to work correctly.
« Reply #9 on: October 06, 2015, 02:38:30 PM »
Hi neophyte,

  I have tried a variety of different size SD cards, 2/4/8/16, all have the same issue with the resize2fs command on the 6.1-X image.

  I have successfully used the 6.1-SSH image and got the resize2fs command to work, but when I try to install TC.tcz i get a number of errors and it won't install properly and therefore you can't get an X system that way.

  I have successfully used the 7.0alpha7 image and the resize2fs works on it. The TC.tcz extension does install correctly and an X system can be run.

  The SSH images merely boot to a command prompt rather than starting the X system, you can access them locally, no need for a LAN connection.

  I suggest you install the 7.0alpha7-SSH image and resize the disk as normal then load the X system extension(s) tce-load -wi TC.tcz and reboot.

  To stop the SSH keys being regenerated each time the system boots run the backup command filetool.sh -b, alternatively you can remove the openssh extension.

HTH

  Jon

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Trouble getting resize2fs to work correctly.
« Reply #10 on: October 06, 2015, 05:59:36 PM »
If you have a problem with on-line resizing, do it off-line. Use base norestore boot options than resize.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline neophyte

  • Newbie
  • *
  • Posts: 11
Re: Trouble getting resize2fs to work correctly.
« Reply #11 on: October 11, 2015, 05:43:26 PM »
@jncl

Thank you for the reply. Sorry I didn't reply sooner, but I have been sick and didn't get the time to respond. I've tried the latest test release and it seems to work so I guess I'll use that and consider the matter closed.