Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #32328 > unrolled thread
| Started by | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| First post | 2025-02-05 19:30 +0000 |
| Last post | 2025-02-12 18:03 +0000 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.arch.embedded
How do you wipe a UBI filesystem? Grant Edwards <invalid@invalid.invalid> - 2025-02-05 19:30 +0000
Re: How do you wipe a UBI filesystem? Grant Edwards <invalid@invalid.invalid> - 2025-02-05 21:15 +0000
Re: How do you wipe a UBI filesystem? chrisq <devzero@nospam.com> - 2025-02-12 15:03 +0000
Re: How do you wipe a UBI filesystem? Grant Edwards <invalid@invalid.invalid> - 2025-02-12 18:03 +0000
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2025-02-05 19:30 +0000 |
| Subject | How do you wipe a UBI filesystem? |
| Message-ID | <vo0e7s$m5v$1@reader2.panix.com> |
Pretend I've got an MTD partition attached as a UBI device. That UBI device contains a couple differen UBI volumes. In one of those volumes is a UBIFS filesystem that has a bunch of files in it. I've done some googling, but all of the answers are "use ubiformat". That will wipe the whole device. I just want to re-initialize one ubifs filesytem in one volume -- not the whole ubi device. How do I wipe that filesystem (set it back to empty). Do I need to create an empty ubifs "image" file using mkfs.ubifs and then use ubiupdatevol to write that image to the volume? Isn't there a simpler way? -- Grant
[toc] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2025-02-05 21:15 +0000 |
| Message-ID | <vo0kdk$1k0$1@reader2.panix.com> |
| In reply to | #32328 |
On 2025-02-05, Grant Edwards <invalid@invalid.invalid> wrote:
> Pretend I've got an MTD partition attached as a UBI device.
>
> That UBI device contains a couple differen UBI volumes.
>
> In one of those volumes is a UBIFS filesystem that has a bunch of
> files in it.
>
> I've done some googling, but all of the answers are "use
> ubiformat". That will wipe the whole device. I just want to
> re-initialize one ubifs filesytem in one volume -- not the whole
> ubi device.
>
> How do I wipe that filesystem (set it back to empty). Do I need to
> create an empty ubifs "image" file using mkfs.ubifs and then use
> ubiupdatevol to write that image to the volume?
>
> Isn't there a simpler way?
I've figured out two other ways to do it:
ubiupdatevol -t /dev/ubiX_Y
mount -t ubifs /dev/ubiX:volname /mnt/point
That works, but apparently that erases every block in the
volume. That's a lot of unecessary wear. Surely you can "empty" the
filesystem without erasing every block in the volume (when probably
90% of the blocks have never been written).
Another option:
ubirmvol /dev/ubiX -N volname
umimkvol /dev/ubiX -N volname -m
mount -t ubifs /dev/ubiX:volname /mnt/point
That too seems to work, but modifying the devices volume table/list
seems a bit risky compared to simply re-initializing the filesystem
inside an existing volume.
[toc] | [prev] | [next] | [standalone]
| From | chrisq <devzero@nospam.com> |
|---|---|
| Date | 2025-02-12 15:03 +0000 |
| Message-ID | <void7a$2cff6$1@dont-email.me> |
| In reply to | #32328 |
On 2/5/25 19:30, Grant Edwards wrote: > Pretend I've got an MTD partition attached as a UBI device. > > That UBI device contains a couple differen UBI volumes. > > In one of those volumes is a UBIFS filesystem that has a bunch of > files in it. > > I've done some googling, but all of the answers are "use > ubiformat". That will wipe the whole device. I just want to > re-initialize one ubifs filesytem in one volume -- not the whole > ubi device. > > How do I wipe that filesystem (set it back to empty). Do I need to > create an empty ubifs "image" file using mkfs.ubifs and then use > ubiupdatevol to write that image to the volume? > > Isn't there a simpler way? > Try a search: "ubi file system utilities Linux" Which may help, third entry down ?. Chris
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2025-02-12 18:03 +0000 |
| Message-ID | <voinor$49s$1@reader2.panix.com> |
| In reply to | #32330 |
On 2025-02-12, chrisq <devzero@nospam.com> wrote: > On 2/5/25 19:30, Grant Edwards wrote: >> Pretend I've got an MTD partition attached as a UBI device. >> >> That UBI device contains a couple differen UBI volumes. >> >> In one of those volumes is a UBIFS filesystem that has a bunch of >> files in it. >> >> I've done some googling, but all of the answers are "use >> ubiformat". That will wipe the whole device. I just want to >> re-initialize one ubifs filesytem in one volume -- not the whole >> ubi device. >> >> How do I wipe that filesystem (set it back to empty). Do I need to >> create an empty ubifs "image" file using mkfs.ubifs and then use >> ubiupdatevol to write that image to the volume? >> >> Isn't there a simpler way? > > Try a search: > > "ubi file system utilities Linux" > > Which may help, third entry down ?. The answer is 'ubiupdatevol -t' (bracketed by umount/mount commands). I had figured out that command worked, but one tutorial/blog I found stated that it erased every block in the volume. The way it was described it sounded like doing a 'ubiupdatevol -t' on a 20MB volume would erase 20MB of flash -- even if that volume contained a filesystem with only a few small files in it. So I was reluctant to use it because of the uneccessary wear on the flash when used on volumes that were mostly empty. It turns out that blog was wrong/misleading. The truncate operation doesn't erase any blocks. It _unmaps_ any _programmed_ blocks that are currently in use in the volume. Those blocks will later be erased and put back in the "free" pool during garbage collection. No blocks are erased either unnecessarily or by the command itself. -- Grant
[toc] | [prev] | [standalone]
Back to top | Article view | comp.arch.embedded
csiph-web