Re: How to detect if ubi volume is empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2024/5/20 18:22, Pintu Agarwal 写道:
Hi,

In Linux Kernel 5.15 is there a way to detect in runtime, if UBI
volume (squashfs based, ubiblock, dynamic) is empty or not ?

There is a way to get the empty state of UBI volume by ioctl UBI_IOCEBUNMAP, for example:

fd = open(UBI_VOLUME, O_EXCL)

check_volume_empty  [1]

close(fd)

[1] https://www.linux-mtd.infradead.org/?p=mtd-utils.git;a=blob;f=ubifs-utils/mkfs.ubifs/mkfs.ubifs.c;h=42a47f839e115567de58e8cdfcc50c4202fc7af1;hb=refs/heads/master#l2804

Based on this we need to make some decisions at runtime.

Currently, we are using a crude way to detect volume empty by reading
the first 1K block using the "dd" command and checking if the contents
are all FF.

Is this good enough, or is there some other better way ?

Thanks.
Pintu

.






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux