All of lore.kernel.org
 help / color / mirror / Atom feed
* can't mount ubifs after resizing with ubirsvol
@ 2011-09-03 22:53 Jon Ringle
  2011-09-05  8:33 ` Matthieu CASTET
  2011-09-09  9:59 ` marco
  0 siblings, 2 replies; 13+ messages in thread
From: Jon Ringle @ 2011-09-03 22:53 UTC (permalink / raw)
  To: linux-mtd

Hi,

I have a ubi0 with a static squashfs part and a ubifs part. Sometimes
I have to update the squashfs with an image that is bigger than the
currently allocated space for the squashfs part. My plan was to use
ubirsvol to reduce the size of the ubifs part, then use ubirsvol in
increase the size of the squashfs part so that it is big enough for
ubiupdatevol to accept the new image in the squashfs part.

But when I try to mount ubifs after resizing, it complains with:
(initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
[ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
in superblock, 800 on UBI volume, 19 minimum required
[ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
mount: mounting ubi0:ubifs on /mnt failed: Invalid argument

Is what I want to do possible?

I am using mtd-utils-1.4.6. Here is more detail.

(initramfs)[/]# uname -a
Linux isc3-initramfs 2.6.33.17 #10 Sat Sep 3 17:56:12 EDT 2011 armv6l GNU/Linux
(initramfs)[/]# ubiattach -p /dev/mtd3
[ 1744.100000] UBI: attaching mtd3 to ubi0
[ 1744.100000] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[ 1744.110000] UBI: logical eraseblock size:    129024 bytes
[ 1744.120000] UBI: smallest flash I/O unit:    2048
[ 1744.120000] UBI: sub-page size:              512
[ 1744.130000] UBI: VID header offset:          512 (aligned 512)
[ 1744.130000] UBI: data offset:                2048
[ 1744.350000] UBI: attached mtd3 to ubi0
[ 1744.360000] UBI: MTD device name:            "ubi"
[ 1744.360000] UBI: MTD device size:            119 MiB
[ 1744.370000] UBI: number of good PEBs:        957
[ 1744.370000] UBI: number of bad PEBs:         0
[ 1744.380000] UBI: max. allowed volumes:       128
[ 1744.380000] UBI: wear-leveling threshold:    4096
[ 1744.380000] UBI: number of internal volumes: 1
[ 1744.390000] UBI: number of user volumes:     2
[ 1744.390000] UBI: available PEBs:             0
[ 1744.400000] UBI: total number of reserved PEBs: 957
[ 1744.400000] UBI: number of PEBs reserved for bad PEB handling: 9
[ 1744.410000] UBI: max/mean erase counter: 79/11
[ 1744.410000] UBI: image sequence number: 0
[ 1744.420000] UBI: background thread "ubi_bgt0d" started, PID 614
UBI device number 0, total 957 LEBs (123475968 bytes, 117.8 MiB),
available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
(initramfs)[/]# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:60
Present UBI devices:            ubi0

ubi0
Volumes count:                           2
Logical eraseblock size:                 129024 bytes, 126.0 KiB
Total amount of logical eraseblocks:     957 (123475968 bytes, 117.8 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  9
Current maximum erase counter value:     79
Minimum input/output unit size:          2048 bytes
Character device major/minor:            253:0
Present volumes:                         0, 1

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        78 LEBs (10063872 bytes, 9.6 MiB)
State:       OK
Name:        squashfs
Character device major/minor: 253:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        866 LEBs (111734784 bytes, 106.6 MiB)
State:       OK
Name:        ubifs
Character device major/minor: 253:2
(initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
[ 1798.380000] UBIFS: mounted UBI device 0, volume 1, name "ubifs"
[ 1798.390000] UBIFS: file system size:   110444544 bytes (107856 KiB,
105 MiB, 856 LEBs)
[ 1798.400000] UBIFS: journal size:       5548032 bytes (5418 KiB, 5
MiB, 43 LEBs)
[ 1798.400000] UBIFS: media format:       w4/r0 (latest is w4/r0)
[ 1798.410000] UBIFS: default compressor: lzo
[ 1798.410000] UBIFS: reserved for root:  4952683 bytes (4836 KiB)
(initramfs)[/]# umount /mnt
[ 1804.060000] UBIFS: un-mount UBI device 0, volume 1
(initramfs)[/]# ubirsvol /dev/ubi0 -N ubifs -S 800
(initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
[ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
in superblock, 800 on UBI volume, 19 minimum required
[ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
mount: mounting ubi0:ubifs on /mnt failed: Invalid argument

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2011-09-03 22:53 can't mount ubifs after resizing with ubirsvol Jon Ringle
@ 2011-09-05  8:33 ` Matthieu CASTET
  2011-09-11 13:17   ` Artem Bityutskiy
  2011-09-09  9:59 ` marco
  1 sibling, 1 reply; 13+ messages in thread
From: Matthieu CASTET @ 2011-09-05  8:33 UTC (permalink / raw)
  To: Jon Ringle; +Cc: linux-mtd

Hi,

Jon Ringle a écrit :
> Hi,
> 
> I have a ubi0 with a static squashfs part and a ubifs part. Sometimes
> I have to update the squashfs with an image that is bigger than the
> currently allocated space for the squashfs part. My plan was to use
> ubirsvol to reduce the size of the ubifs part, then use ubirsvol in
> increase the size of the squashfs part so that it is big enough for
> ubiupdatevol to accept the new image in the squashfs part.
> 
> But when I try to mount ubifs after resizing, it complains with:
> (initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
> [ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
> in superblock, 800 on UBI volume, 19 minimum required
> [ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
> mount: mounting ubi0:ubifs on /mnt failed: Invalid argument
> 
> Is what I want to do possible?
> 
AFAIK you can't reduce size of ubifs volume, you can only increase it.


Matthieu

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2011-09-03 22:53 can't mount ubifs after resizing with ubirsvol Jon Ringle
  2011-09-05  8:33 ` Matthieu CASTET
@ 2011-09-09  9:59 ` marco
  1 sibling, 0 replies; 13+ messages in thread
From: marco @ 2011-09-09  9:59 UTC (permalink / raw)
  To: linux-mtd

Jon Ringle <jon <at> ringle.org> writes:

> 
> Hi,
> 
> I have a ubi0 with a static squashfs part and a ubifs part. Sometimes
> I have to update the squashfs with an image that is bigger than the
> currently allocated space for the squashfs part. My plan was to use
> ubirsvol to reduce the size of the ubifs part, then use ubirsvol in
> increase the size of the squashfs part so that it is big enough for
> ubiupdatevol to accept the new image in the squashfs part.
> 
> But when I try to mount ubifs after resizing, it complains with:
> (initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
> [ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
> in superblock, 800 on UBI volume, 19 minimum required
> [ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
> mount: mounting ubi0:ubifs on /mnt failed: Invalid argument
> 
> Is what I want to do possible?
> 
> I am using mtd-utils-1.4.6. Here is more detail.
> 
> (initramfs)[/]# uname -a
> Linux isc3-initramfs 2.6.33.17 #10 Sat Sep 3 17:56:12 EDT 2011 armv6l GNU/Linux
> (initramfs)[/]# ubiattach -p /dev/mtd3
> [ 1744.100000] UBI: attaching mtd3 to ubi0
> [ 1744.100000] UBI: physical eraseblock size:   131072 bytes (128 KiB)
> [ 1744.110000] UBI: logical eraseblock size:    129024 bytes
> [ 1744.120000] UBI: smallest flash I/O unit:    2048
> [ 1744.120000] UBI: sub-page size:              512
> [ 1744.130000] UBI: VID header offset:          512 (aligned 512)
> [ 1744.130000] UBI: data offset:                2048
> [ 1744.350000] UBI: attached mtd3 to ubi0
> [ 1744.360000] UBI: MTD device name:            "ubi"
> [ 1744.360000] UBI: MTD device size:            119 MiB
> [ 1744.370000] UBI: number of good PEBs:        957
> [ 1744.370000] UBI: number of bad PEBs:         0
> [ 1744.380000] UBI: max. allowed volumes:       128
> [ 1744.380000] UBI: wear-leveling threshold:    4096
> [ 1744.380000] UBI: number of internal volumes: 1
> [ 1744.390000] UBI: number of user volumes:     2
> [ 1744.390000] UBI: available PEBs:             0
> [ 1744.400000] UBI: total number of reserved PEBs: 957
> [ 1744.400000] UBI: number of PEBs reserved for bad PEB handling: 9
> [ 1744.410000] UBI: max/mean erase counter: 79/11
> [ 1744.410000] UBI: image sequence number: 0
> [ 1744.420000] UBI: background thread "ubi_bgt0d" started, PID 614
> UBI device number 0, total 957 LEBs (123475968 bytes, 117.8 MiB),
> available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
> (initramfs)[/]# ubinfo -a
> UBI version:                    1
> Count of UBI devices:           1
> UBI control device major/minor: 10:60
> Present UBI devices:            ubi0
> 
> ubi0
> Volumes count:                           2
> Logical eraseblock size:                 129024 bytes, 126.0 KiB
> Total amount of logical eraseblocks:     957 (123475968 bytes, 117.8 MiB)
> Amount of available logical eraseblocks: 0 (0 bytes)
> Maximum count of volumes                 128
> Count of bad physical eraseblocks:       0
> Count of reserved physical eraseblocks:  9
> Current maximum erase counter value:     79
> Minimum input/output unit size:          2048 bytes
> Character device major/minor:            253:0
> Present volumes:                         0, 1
> 
> Volume ID:   0 (on ubi0)
> Type:        dynamic
> Alignment:   1
> Size:        78 LEBs (10063872 bytes, 9.6 MiB)
> State:       OK
> Name:        squashfs
> Character device major/minor: 253:1
> -----------------------------------
> Volume ID:   1 (on ubi0)
> Type:        dynamic
> Alignment:   1
> Size:        866 LEBs (111734784 bytes, 106.6 MiB)
> State:       OK
> Name:        ubifs
> Character device major/minor: 253:2
> (initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
> [ 1798.380000] UBIFS: mounted UBI device 0, volume 1, name "ubifs"
> [ 1798.390000] UBIFS: file system size:   110444544 bytes (107856 KiB,
> 105 MiB, 856 LEBs)
> [ 1798.400000] UBIFS: journal size:       5548032 bytes (5418 KiB, 5
> MiB, 43 LEBs)
> [ 1798.400000] UBIFS: media format:       w4/r0 (latest is w4/r0)
> [ 1798.410000] UBIFS: default compressor: lzo
> [ 1798.410000] UBIFS: reserved for root:  4952683 bytes (4836 KiB)
> (initramfs)[/]# umount /mnt
> [ 1804.060000] UBIFS: un-mount UBI device 0, volume 1
> (initramfs)[/]# ubirsvol /dev/ubi0 -N ubifs -S 800
> (initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
> [ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
> in superblock, 800 on UBI volume, 19 minimum required
> [ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
> mount: mounting ubi0:ubifs on /mnt failed: Invalid argument
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 
> 

NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad eraseblock 4236 at 0x000021180000

Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "bootloader"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 1GiB 3,3V 8-bit" --
size truncated to 0x3faa0000
0x000000000000-0x000040000000 : "nand"

>> ubiformat --version
1.5


>>ls -la /dev/ubi_ctrl 
crw-rw----    1 root     root       10,  58 Sep  5  2011 /dev/ubi_ctrl

First time:


>> ubiformat /dev/mtd3 -y -e 0 
ubiformat: mtd3 (nand), size 1068105728 bytes (1018.6 MiB), 8149 eraseblocks of
131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 8148 -- 100 % complete  
ubiformat: 8144 eraseblocks are supposedly empty
ubiformat: 5 bad eraseblocks found, numbers: 4193, 8145, 8146, 8147, 8148
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 8148 -- 100 % complete  block 2397 -- 29 %
complete  

>> ubiattach /dev/ubi_ctrl -m 3
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: max. sequence number:       0
UBI error: ubi_read_volume_table: the layout volume was not found
ubiattach: error!: cannot attach mtd3
           error 22 (Invalid argument)



Second time:


>> ubiformat /dev/mtd3 -y -e 0 -f /ubi.img 
ubiformat: mtd3 (nand), size 1068105728 bytes (1018.6 MiB), 8149 eraseblocks of
131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan:nand_bbt: Error while writing bad block table -5
libscan: scanning eraseblock 8148 -- 100 % complete  
ubiformat: 5 bad eraseblocks found, numbers: 4193, 8145, 8146, 8147, 8148
ubiformat: warning!: 8144 of 8144 eraseblocks contain non-ubifs data
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: flashing eraseblock 0 --  6 % complete  libmtd: error!: MEMERASE64
ioctl failed for eraseblock 0 (mtd3)
        error 5 (Input/output error)

ubiformat: error!: failed to erase eraseblock 0
           error 5 (Input/output error)
ubiformat: marking block 0 bad
libmtd: error!: MEMSETBADBLOCK ioctl failed for eraseblock 0 (mtd3)
        error 5 (Input/output error)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2011-09-05  8:33 ` Matthieu CASTET
@ 2011-09-11 13:17   ` Artem Bityutskiy
  2015-11-09 14:04     ` Ibrahim Mattus Neto
  0 siblings, 1 reply; 13+ messages in thread
From: Artem Bityutskiy @ 2011-09-11 13:17 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mtd, Jon Ringle

On Mon, 2011-09-05 at 10:33 +0200, Matthieu CASTET wrote:
> Hi,
> 
> Jon Ringle a écrit :
> > Hi,
> > 
> > I have a ubi0 with a static squashfs part and a ubifs part. Sometimes
> > I have to update the squashfs with an image that is bigger than the
> > currently allocated space for the squashfs part. My plan was to use
> > ubirsvol to reduce the size of the ubifs part, then use ubirsvol in
> > increase the size of the squashfs part so that it is big enough for
> > ubiupdatevol to accept the new image in the squashfs part.
> > 
> > But when I try to mount ubifs after resizing, it complains with:
> > (initramfs)[/]# mount -t ubifs ubi0:ubifs /mnt
> > [ 1838.350000] UBIFS error (pid 621): validate_sb: bad LEB count: 866
> > in superblock, 800 on UBI volume, 19 minimum required
> > [ 1838.360000] UBIFS error (pid 621): validate_sb: bad superblock, error 1
> > mount: mounting ubi0:ubifs on /mnt failed: Invalid argument
> > 
> > Is what I want to do possible?
> > 
> AFAIK you can't reduce size of ubifs volume, you can only increase it.

Right, shrinking is not currently supported. It is possible to
implement, but needs efforts and time (as many of other things people
want).

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* can't mount ubifs after resizing with ubirsvol
  2011-09-11 13:17   ` Artem Bityutskiy
@ 2015-11-09 14:04     ` Ibrahim Mattus Neto
  2015-11-18 20:01       ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Ibrahim Mattus Neto @ 2015-11-09 14:04 UTC (permalink / raw)
  To: linux-mtd

Hi!

I am having problems resizing a ubifs volume, I used the command 
ubirsvol (version: 1.5.1) but when I try mounting it I get the following 
error:

[ 8840.450000] UBIFS error (ubi0:1 pid 720): validate_sb: bad LEB count: 
413 in superblock, 331 on UBI volume, 19 minimum required
[ 8840.460000] UBIFS error (ubi0:1 pid 720): validate_sb: bad 
superblock, error 1
[ 8840.470000]  magic          0x6101831
[ 8840.480000]  crc            0x539e8e1c
[ 8840.480000]  node_type      6 (superblock node)
[ 8840.480000]  group_type     0 (no node group)
[ 8840.490000]  sqnum          1
[ 8840.490000]  len            4096
[ 8840.490000]  key_hash       0 (R5)
[ 8840.500000]  key_fmt        0 (simple)
[ 8840.500000]  flags          0x0
[ 8840.500000]  big_lpt        0
[ 8840.510000]  space_fixup    0
[ 8840.510000]  min_io_size    2048
[ 8840.510000]  leb_size       126976
[ 8840.520000]  leb_cnt        413
[ 8840.520000]  max_leb_cnt    413
[ 8840.520000]  max_bud_bytes  2158592
[ 8840.530000]  log_lebs       3
[ 8840.530000]  lpt_lebs       2
[ 8840.530000]  orph_lebs      2
[ 8840.540000]  jhead_cnt      1
[ 8840.540000]  fanout         8
[ 8840.540000]  lsave_cnt      256
[ 8840.540000]  default_compr  1
[ 8840.550000]  rp_size        2558566
[ 8840.550000]  rp_uid         0
[ 8840.550000]  rp_gid         0
[ 8840.560000]  fmt_version    4
[ 8840.560000]  time_gran      1000000000
[ 8840.560000]  UUID           B1F16610-EEDF-471F-B5AD-279F21C00729
mount: mounting ubi0:recover on /recover failed: Invalid argument

I was reading through the archives and found a similar issue but no 
solution, is there a way to shrink a volume?

I was thinking about changing the LEB count inside the superblock but I 
didn't know how to (and thought it would be too risky)

Thanks in advance,
Ibrahim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-09 14:04     ` Ibrahim Mattus Neto
@ 2015-11-18 20:01       ` Richard Weinberger
  2015-11-19 13:34         ` Ibrahim Mattus Neto
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2015-11-18 20:01 UTC (permalink / raw)
  To: Ibrahim Mattus Neto; +Cc: linux-mtd

On Mon, Nov 9, 2015 at 3:04 PM, Ibrahim Mattus Neto
<ibrahim.neto@writesys.com.br> wrote:
> Hi!
>
> I am having problems resizing a ubifs volume, I used the command ubirsvol
> (version: 1.5.1) but when I try mounting it I get the following error:
>
> [ 8840.450000] UBIFS error (ubi0:1 pid 720): validate_sb: bad LEB count: 413
> in superblock, 331 on UBI volume, 19 minimum required
> [ 8840.460000] UBIFS error (ubi0:1 pid 720): validate_sb: bad superblock,
> error 1
> [ 8840.470000]  magic          0x6101831
> [ 8840.480000]  crc            0x539e8e1c
> [ 8840.480000]  node_type      6 (superblock node)
> [ 8840.480000]  group_type     0 (no node group)
> [ 8840.490000]  sqnum          1
> [ 8840.490000]  len            4096
> [ 8840.490000]  key_hash       0 (R5)
> [ 8840.500000]  key_fmt        0 (simple)
> [ 8840.500000]  flags          0x0
> [ 8840.500000]  big_lpt        0
> [ 8840.510000]  space_fixup    0
> [ 8840.510000]  min_io_size    2048
> [ 8840.510000]  leb_size       126976
> [ 8840.520000]  leb_cnt        413
> [ 8840.520000]  max_leb_cnt    413
> [ 8840.520000]  max_bud_bytes  2158592
> [ 8840.530000]  log_lebs       3
> [ 8840.530000]  lpt_lebs       2
> [ 8840.530000]  orph_lebs      2
> [ 8840.540000]  jhead_cnt      1
> [ 8840.540000]  fanout         8
> [ 8840.540000]  lsave_cnt      256
> [ 8840.540000]  default_compr  1
> [ 8840.550000]  rp_size        2558566
> [ 8840.550000]  rp_uid         0
> [ 8840.550000]  rp_gid         0
> [ 8840.560000]  fmt_version    4
> [ 8840.560000]  time_gran      1000000000
> [ 8840.560000]  UUID           B1F16610-EEDF-471F-B5AD-279F21C00729
> mount: mounting ubi0:recover on /recover failed: Invalid argument
>
> I was reading through the archives and found a similar issue but no
> solution, is there a way to shrink a volume?
>
> I was thinking about changing the LEB count inside the superblock but I
> didn't know how to (and thought it would be too risky)

Please more details. :)
What exactly did you do?

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-18 20:01       ` Richard Weinberger
@ 2015-11-19 13:34         ` Ibrahim Mattus Neto
  2015-11-19 13:42           ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Ibrahim Mattus Neto @ 2015-11-19 13:34 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd

Hi Richard!

Thanks for the response.

What I did was:

1) I created an .ubi file using the following configuration.
[rootfs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
image=rootfs.ubifs
vol_size=80MiB

[data]
mode=ubi
vol_id=1
vol_type=dynamic
vol_name=data
vol_alignment=1
vol_flags=autoresize
vol_size=10MiB

[recover]
mode=ubi
vol_id=2
vol_type=dynamic
vol_name=recover
vol_alignment=1
vol_size=5MiB

2) After booting I tried to shrink "data" and increase the size of 
recover using ubirsvol:

ubirsvol /dev/ubi0 -n 1 -s 4MiB    (data)

ubirsvol /dev/ubi0 -n 2 -s 15MiB (recover)

3) After the resizing I tried to mount "data"

mount /home/data/
[   88.510000] UBIFS error (ubi0:1 pid 668): validate_sb: bad LEB count: 
1159 in superblock, 34 on UBI volume, 20 minimum required
[   88.520000] UBIFS error (ubi0:1 pid 668): validate_sb: bad 
superblock, error 1
[   88.530000]  magic          0x6101831
[   88.530000]  crc            0xceeca05b
[   88.540000]  node_type      6 (superblock node)
[   88.540000]  group_type     0 (no node group)
[   88.550000]  sqnum          1
[   88.550000]  len            4096
[   88.550000]  key_hash       0 (R5)
[   88.560000]  key_fmt        0 (simple)
[   88.560000]  flags          0x0
[   88.560000]  big_lpt        0
[   88.570000]  space_fixup    0
[   88.570000]  min_io_size    2048
[   88.570000]  leb_size       126976
[   88.580000]  leb_cnt        1159
[   88.580000]  max_leb_cnt    1159
[   88.580000]  max_bud_bytes  6729728
[   88.590000]  log_lebs       4
[   88.590000]  lpt_lebs       2
[   88.590000]  orph_lebs      2
[   88.600000]  jhead_cnt      1
[   88.600000]  fanout         8
[   88.600000]  lsave_cnt      256
[   88.600000]  default_compr  1
[   88.610000]  rp_size        5242880
[   88.610000]  rp_uid         0
[   88.610000]  rp_gid         0
[   88.620000]  fmt_version    4
[   88.620000]  time_gran      1000000000
[   88.620000]  UUID 9A5BA9F3-D0AC-480D-8F5B-8BF723E8A517
mount: mounting /dev/ubi0_1 on /home/data failed: Invalid argument


4) Then I tried to mount "recover"

# mount /recover/
[   84.560000] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, 
PID 666
[   84.590000] UBIFS error (ubi0:2 pid 664): ubifs_read_node: bad node 
type (255 but expected 9)
[   84.600000] UBIFS error (ubi0:2 pid 664): ubifs_read_node: bad node 
at LEB 10:0, LEB mapping status 0
[   84.600000] Not a node, first 24 bytes:
[   84.610000] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
ff ff ff ff ff ff ff ff ........................
[   84.620000] CPU: 0 PID: 664 Comm: mount Not tainted 4.2.6 #1
[   84.630000] Hardware name: Atmel SAMA5
[   84.630000] [<c0013e38>] (unwind_backtrace) from [<c0011d48>] 
(show_stack+0x10/0x14)
[   84.640000] [<c0011d48>] (show_stack) from [<c01a64b8>] 
(ubifs_read_node+0x290/0x30c)
[   84.650000] [<c01a64b8>] (ubifs_read_node) from [<c01aefc8>] 
(dbg_old_index_check_init+0x64/0xa4)
[   84.660000] [<c01aefc8>] (dbg_old_index_check_init) from [<c01a1b4c>] 
(ubifs_mount+0x2fc/0x17b0)
[   84.660000] [<c01a1b4c>] (ubifs_mount) from [<c0095f18>] 
(mount_fs+0x14/0xa4)
[   84.670000] [<c0095f18>] (mount_fs) from [<c00abe64>] 
(vfs_kern_mount+0x4c/0xf8)
[   84.680000] [<c00abe64>] (vfs_kern_mount) from [<c00ae6e8>] 
(do_mount+0x1a0/0xb28)
[   84.690000] [<c00ae6e8>] (do_mount) from [<c00af3cc>] 
(SyS_mount+0x90/0xc4)
[   84.690000] [<c00af3cc>] (SyS_mount) from [<c000f1a0>] 
(ret_fast_syscall+0x0/0x3c)
[   84.700000] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops


5) Just to gather some information

# ubinfo -a
UBI version:                    1
Count of UBI devices:           2
UBI control device major/minor: 10:59
Present UBI devices:            ubi0

ubi0
Volumes count:                           3
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1902 (241508352 bytes, 230.3 MiB)
Amount of available logical eraseblocks: 1043 (132435968 bytes, 126.3 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       4
Count of reserved physical eraseblocks:  36
Current maximum erase counter value:     2
Minimum input/output unit size:          2048 bytes
Character device major/minor:            251:0
Present volumes:                         0, 1, 2

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        661 LEBs (83931136 bytes, 80.0 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 251:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        34 LEBs (4317184 bytes, 4.1 MiB)
State:       OK
Name:        data
Character device major/minor: 251:2
-----------------------------------
Volume ID:   2 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        124 LEBs (15745024 bytes, 15.0 MiB)
State:       OK
Name:        recover
Character device major/minor: 251:3

===================================


This is all I managed  to get of information.
Did I forgot something?

Once again, thank you for your help!

--Ibrahim


On 18/11/2015 18:01, Richard Weinberger wrote:
> On Mon, Nov 9, 2015 at 3:04 PM, Ibrahim Mattus Neto
> <ibrahim.neto@writesys.com.br> wrote:
>> Hi!
>>
>> I am having problems resizing a ubifs volume, I used the command ubirsvol
>> (version: 1.5.1) but when I try mounting it I get the following error:
>>
>> [ 8840.450000] UBIFS error (ubi0:1 pid 720): validate_sb: bad LEB count: 413
>> in superblock, 331 on UBI volume, 19 minimum required
>> [ 8840.460000] UBIFS error (ubi0:1 pid 720): validate_sb: bad superblock,
>> error 1
>> [ 8840.470000]  magic          0x6101831
>> [ 8840.480000]  crc            0x539e8e1c
>> [ 8840.480000]  node_type      6 (superblock node)
>> [ 8840.480000]  group_type     0 (no node group)
>> [ 8840.490000]  sqnum          1
>> [ 8840.490000]  len            4096
>> [ 8840.490000]  key_hash       0 (R5)
>> [ 8840.500000]  key_fmt        0 (simple)
>> [ 8840.500000]  flags          0x0
>> [ 8840.500000]  big_lpt        0
>> [ 8840.510000]  space_fixup    0
>> [ 8840.510000]  min_io_size    2048
>> [ 8840.510000]  leb_size       126976
>> [ 8840.520000]  leb_cnt        413
>> [ 8840.520000]  max_leb_cnt    413
>> [ 8840.520000]  max_bud_bytes  2158592
>> [ 8840.530000]  log_lebs       3
>> [ 8840.530000]  lpt_lebs       2
>> [ 8840.530000]  orph_lebs      2
>> [ 8840.540000]  jhead_cnt      1
>> [ 8840.540000]  fanout         8
>> [ 8840.540000]  lsave_cnt      256
>> [ 8840.540000]  default_compr  1
>> [ 8840.550000]  rp_size        2558566
>> [ 8840.550000]  rp_uid         0
>> [ 8840.550000]  rp_gid         0
>> [ 8840.560000]  fmt_version    4
>> [ 8840.560000]  time_gran      1000000000
>> [ 8840.560000]  UUID           B1F16610-EEDF-471F-B5AD-279F21C00729
>> mount: mounting ubi0:recover on /recover failed: Invalid argument
>>
>> I was reading through the archives and found a similar issue but no
>> solution, is there a way to shrink a volume?
>>
>> I was thinking about changing the LEB count inside the superblock but I
>> didn't know how to (and thought it would be too risky)
> Please more details. :)
> What exactly did you do?
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-19 13:34         ` Ibrahim Mattus Neto
@ 2015-11-19 13:42           ` Richard Weinberger
  2015-11-19 14:09             ` Konstantin Tokarev
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2015-11-19 13:42 UTC (permalink / raw)
  To: Ibrahim Mattus Neto; +Cc: linux-mtd

Hi!

Am 19.11.2015 um 14:34 schrieb Ibrahim Mattus Neto:
> Hi Richard!
> 
> Thanks for the response.
> 
> What I did was:
> 
> 1) I created an .ubi file using the following configuration.
> [rootfs]
> mode=ubi
> vol_id=0
> vol_type=dynamic
> vol_name=rootfs
> vol_alignment=1
> image=rootfs.ubifs
> vol_size=80MiB
> 
> [data]
> mode=ubi
> vol_id=1
> vol_type=dynamic
> vol_name=data
> vol_alignment=1
> vol_flags=autoresize
> vol_size=10MiB
> 
> [recover]
> mode=ubi
> vol_id=2
> vol_type=dynamic
> vol_name=recover
> vol_alignment=1
> vol_size=5MiB
> 
> 2) After booting I tried to shrink "data" and increase the size of recover using ubirsvol:
> 
> ubirsvol /dev/ubi0 -n 1 -s 4MiB    (data)
> 
> ubirsvol /dev/ubi0 -n 2 -s 15MiB (recover)
> 
> 3) After the resizing I tried to mount "data"
> 
> mount /home/data/
> [   88.510000] UBIFS error (ubi0:1 pid 668): validate_sb: bad LEB count: 1159 in superblock, 34 on UBI volume, 20 minimum required
> [   88.520000] UBIFS error (ubi0:1 pid 668): validate_sb: bad superblock, error 1

This cannot work. You resized the UBI *volume*, not the UBIFS filesystem.
And unless I'm very mistaken UBIFS does not support shrinking anyway.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-19 13:42           ` Richard Weinberger
@ 2015-11-19 14:09             ` Konstantin Tokarev
  2015-11-19 15:02               ` Richard Weinberger
  0 siblings, 1 reply; 13+ messages in thread
From: Konstantin Tokarev @ 2015-11-19 14:09 UTC (permalink / raw)
  To: Richard Weinberger, Ibrahim Mattus Neto; +Cc: linux-mtd



19.11.2015, 16:44, "Richard Weinberger" <richard@nod.at>:
> Hi!
>
> Am 19.11.2015 um 14:34 schrieb Ibrahim Mattus Neto:
>>  Hi Richard!
>>
>>  Thanks for the response.
>>
>>  What I did was:
>>
>>  1) I created an .ubi file using the following configuration.
>>  [rootfs]
>>  mode=ubi
>>  vol_id=0
>>  vol_type=dynamic
>>  vol_name=rootfs
>>  vol_alignment=1
>>  image=rootfs.ubifs
>>  vol_size=80MiB
>>
>>  [data]
>>  mode=ubi
>>  vol_id=1
>>  vol_type=dynamic
>>  vol_name=data
>>  vol_alignment=1
>>  vol_flags=autoresize
>>  vol_size=10MiB
>>
>>  [recover]
>>  mode=ubi
>>  vol_id=2
>>  vol_type=dynamic
>>  vol_name=recover
>>  vol_alignment=1
>>  vol_size=5MiB
>>
>>  2) After booting I tried to shrink "data" and increase the size of recover using ubirsvol:
>>
>>  ubirsvol /dev/ubi0 -n 1 -s 4MiB (data)
>>
>>  ubirsvol /dev/ubi0 -n 2 -s 15MiB (recover)
>>
>>  3) After the resizing I tried to mount "data"
>>
>>  mount /home/data/
>>  [ 88.510000] UBIFS error (ubi0:1 pid 668): validate_sb: bad LEB count: 1159 in superblock, 34 on UBI volume, 20 minimum required
>>  [ 88.520000] UBIFS error (ubi0:1 pid 668): validate_sb: bad superblock, error 1
>
> This cannot work. You resized the UBI *volume*, not the UBIFS filesystem.
> And unless I'm very mistaken UBIFS does not support shrinking anyway.

I can confirm that shrinking UBIFS volume corrupts it.

-- 
Regards,
Konstantin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-19 14:09             ` Konstantin Tokarev
@ 2015-11-19 15:02               ` Richard Weinberger
  2015-11-20  0:09                 ` Dongsheng Yang
       [not found]                 ` <564DEEEF.7010102@writesys.com.br>
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Weinberger @ 2015-11-19 15:02 UTC (permalink / raw)
  To: Konstantin Tokarev, Ibrahim Mattus Neto; +Cc: linux-mtd

Am 19.11.2015 um 15:09 schrieb Konstantin Tokarev:
> I can confirm that shrinking UBIFS volume corrupts it.

There are no UBIFS volumes.
If you shrink a UBI volume, you kill UBIFS for sure.
It is like shrinking a HDD partition without resizing ext4 before.

Maybe we can do a resizeubifs tool at some point.
I'm currently checking the source what we need for a online-shrink...

Thanks,
//richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-19 15:02               ` Richard Weinberger
@ 2015-11-20  0:09                 ` Dongsheng Yang
       [not found]                 ` <564DEEEF.7010102@writesys.com.br>
  1 sibling, 0 replies; 13+ messages in thread
From: Dongsheng Yang @ 2015-11-20  0:09 UTC (permalink / raw)
  To: Richard Weinberger, Konstantin Tokarev, Ibrahim Mattus Neto; +Cc: linux-mtd

On 11/19/2015 11:02 PM, Richard Weinberger wrote:
> Am 19.11.2015 um 15:09 schrieb Konstantin Tokarev:
>> I can confirm that shrinking UBIFS volume corrupts it.
>
> There are no UBIFS volumes.
> If you shrink a UBI volume, you kill UBIFS for sure.
> It is like shrinking a HDD partition without resizing ext4 before.
>
> Maybe we can do a resizeubifs tool at some point.
> I'm currently checking the source what we need for a online-shrink...

Interesting idea. What about a ubifs tool with a subcommand named as
resize? Then we can add more subcommands for ubifs. Anyway, waiting for 
your
patch. :)

Thanx
Yang

>
> Thanks,
> //richard
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
       [not found]                 ` <564DEEEF.7010102@writesys.com.br>
@ 2015-11-22 21:43                   ` Richard Weinberger
  2015-11-23 13:43                     ` Ibrahim Mattus Neto
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Weinberger @ 2015-11-22 21:43 UTC (permalink / raw)
  To: Ibrahim Mattus Neto, Konstantin Tokarev; +Cc: linux-mtd

Ibrahim,

Am 19.11.2015 um 16:46 schrieb Ibrahim Mattus Neto:
> Hi!
> 
> On 19/11/2015 13:02, Richard Weinberger wrote:
>> Am 19.11.2015 um 15:09 schrieb Konstantin Tokarev:
>>> I can confirm that shrinking UBIFS volume corrupts it.
>> There are no UBIFS volumes.
> 
> You mean that there are no UBIFS volumes because of the config file? e.g.

UBIFS has no volumes, it is a filesystem.
UBI has volumes. :-)

>  [data]
>  mode=ubi
>  vol_id=1
>  vol_type=dynamic
>  vol_name=data
>  vol_alignment=1
>  vol_flags=autoresize
>  vol_size=10MiB
> 
> 
> 
>> If you shrink a UBI volume, you kill UBIFS for sure.
>> It is like shrinking a HDD partition without resizing ext4 before.
> 
> In this case, should I use ubiupdatevol (with a new ubifs file) after resizing the ubi volume?

You can. (As long the UBIFS fits into the UBI volume)

Thanks,
//richard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: can't mount ubifs after resizing with ubirsvol
  2015-11-22 21:43                   ` Richard Weinberger
@ 2015-11-23 13:43                     ` Ibrahim Mattus Neto
  0 siblings, 0 replies; 13+ messages in thread
From: Ibrahim Mattus Neto @ 2015-11-23 13:43 UTC (permalink / raw)
  To: Richard Weinberger, Konstantin Tokarev; +Cc: linux-mtd


On 22/11/2015 19:43, Richard Weinberger wrote:
> Ibrahim,
>
> Am 19.11.2015 um 16:46 schrieb Ibrahim Mattus Neto:
>> Hi!
>>
>> On 19/11/2015 13:02, Richard Weinberger wrote:
>>> Am 19.11.2015 um 15:09 schrieb Konstantin Tokarev:
>>>> I can confirm that shrinking UBIFS volume corrupts it.
>>> There are no UBIFS volumes.
>> You mean that there are no UBIFS volumes because of the config file? e.g.
> UBIFS has no volumes, it is a filesystem.
> UBI has volumes. :-)

My bad... got  a little confused :(

>
>>   [data]
>>   mode=ubi
>>   vol_id=1
>>   vol_type=dynamic
>>   vol_name=data
>>   vol_alignment=1
>>   vol_flags=autoresize
>>   vol_size=10MiB
>>
>>
>>
>>> If you shrink a UBI volume, you kill UBIFS for sure.
>>> It is like shrinking a HDD partition without resizing ext4 before.
>> In this case, should I use ubiupdatevol (with a new ubifs file) after resizing the ubi volume?
> You can. (As long the UBIFS fits into the UBI volume)
>
> Thanks,
> //richard

Thank you for your time!
Best,
--Ibrahim

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-11-23 13:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-03 22:53 can't mount ubifs after resizing with ubirsvol Jon Ringle
2011-09-05  8:33 ` Matthieu CASTET
2011-09-11 13:17   ` Artem Bityutskiy
2015-11-09 14:04     ` Ibrahim Mattus Neto
2015-11-18 20:01       ` Richard Weinberger
2015-11-19 13:34         ` Ibrahim Mattus Neto
2015-11-19 13:42           ` Richard Weinberger
2015-11-19 14:09             ` Konstantin Tokarev
2015-11-19 15:02               ` Richard Weinberger
2015-11-20  0:09                 ` Dongsheng Yang
     [not found]                 ` <564DEEEF.7010102@writesys.com.br>
2015-11-22 21:43                   ` Richard Weinberger
2015-11-23 13:43                     ` Ibrahim Mattus Neto
2011-09-09  9:59 ` marco

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.