Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: effective use of blkdiscard(8)?
nia writes:
> blkdiscard(8) seems like a command in -current that's useful for regular
> maintenance of SSDs.
>
> I would assume that a regular run of:
>
> blkdiscard -v /dev/rwd0d
>
> would be useful to TRIM an entire SSD, obviously destructively, so would
> be useful when reinstalling NetBSD.
correct.
> However, what about less obvious cases?
>
> A large file could be created, for example, with dd:
>
> # dd if=/dev/zero of=./testfile bs=4m count=10000
>
> Then discarded:
>
> # blkdiscard -v ./testfile
>
> Would this effectively mark 40GB of this drive unused to its controller?
that's my understanding, given that the questions you ask below
are handled to be "yes". it certainly does seem to be the case
in my testing -- sometimes reading this data would return the
same data, sometimes random data (!? where from?), and most of
the time, zeroes -- so it certainly was triggering the storage.
an additional thing we could/should add is "fstrim", which is
designed to be run eg, weekly, and the idea is to tell the disk
to discard all the unallocated sectors on the disk, which would
give you the above feature without having to do anything, and
infact give it to you for all the unused space. i have not
looked at how linux implements this, but it clearly needs the
file system itself to implement the backend.
> How good are we at propgating TRIM commands through various block device
> layers?
>
> Is fdiscard() effective on a file on FFSv2 on a cgd(4) on a dk(4) wedge?
>
> What about ZFS on a dk(4) on a cgd(4) on a dk(4) wedge?
all of this depends upon what their driver 'd_discard'
method does. the only ones that are not assigned to be
"nodiscard" are:
/home/src/current/src/sys/dev/ld.c:95: .d_discard = lddiscard,
/home/src/current/src/sys/dev/ld.c:110: .d_discard = lddiscard,
/home/src/current/src/sys/dev/ld.c:123: .d_discard = ld_discard
/home/src/current/src/sys/dev/ata/wd.c:154: .d_discard = wddiscard,
/home/src/current/src/sys/dev/ata/wd.c:171: .d_discard = wddiscard,
/home/src/current/src/sys/dev/ata/wd.c:230: .d_discard = wd_discard
/home/src/current/src/sys/dev/dkwedge/dk.c:125: .d_discard = dkdiscard,
/home/src/current/src/sys/dev/dkwedge/dk.c:140: .d_discard = dkdiscard,
so the vast majority of disk drivers do not support
this yet.
.mrg.
Home |
Main Index |
Thread Index |
Old Index