* [CACHE DEVICE] Space usage @ 2021-04-04 16:15 Giuseppe Della Bianca 2021-04-04 19:41 ` Kai Krakow 0 siblings, 1 reply; 3+ messages in thread From: Giuseppe Della Bianca @ 2021-04-04 16:15 UTC (permalink / raw) To: linux-bcache Hi. In SSDs, full use of available space causes speed and durability problems. bcahe uses all the available space in the cache device? I could not find information on the maximum space used or how to set it. gdb ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CACHE DEVICE] Space usage 2021-04-04 16:15 [CACHE DEVICE] Space usage Giuseppe Della Bianca @ 2021-04-04 19:41 ` Kai Krakow 2021-04-05 10:43 ` gius db 0 siblings, 1 reply; 3+ messages in thread From: Kai Krakow @ 2021-04-04 19:41 UTC (permalink / raw) To: Giuseppe Della Bianca; +Cc: linux-bcache Hi! Am So., 4. Apr. 2021 um 18:23 Uhr schrieb Giuseppe Della Bianca <giusdbg@gmail.com>: > In SSDs, full use of available space causes speed and durability problems. > > bcahe uses all the available space in the cache device? > > I could not find information on the maximum space used or how to set it. There's no option for that in bcache. Instead, create a smaller partition for bcache, then create a second partition filling the rest of the device. You may want to use a size ratio of 80:20 for these partitions tho modern drives usually already have an internal reserve area, so 90:10 may be fine, too. Now, use the blkdiscard command to trim the second partition. That way the SSD knows that this is unused space it can use for wear leveling. You may remove this second partition if you want to. In either case, don't write anything to this space in the future. Now continue to install bcache to the first partition created. I've never seen any performance or endurance gains here using modern Samsung drives so I've gone with using 100% for bcache. But my older smaller drives had seen a benefit (usually better performance than better lifetime) from using 80:20 or 90:10. So I'd say the bigger the drive, the less likely you need to reserve any trimmed space. So currently I'm using a hybrid approach and made the second partition into a big swap partition: Most of it will stay trimmed but if the system has to swap, it will at least find fast swap space here, and it can be used for cold hibernation. You should not do that, tho, if your system is low on memory: Swap isn't meant as emergency memory, and it isn't meant as an extension to installed RAM. It's a space where the system can put anonymous memory that's never used to make space for disk caching. Only in that case, it's hardly ever written to or read from. Regards, Kai ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CACHE DEVICE] Space usage 2021-04-04 19:41 ` Kai Krakow @ 2021-04-05 10:43 ` gius db 0 siblings, 0 replies; 3+ messages in thread From: gius db @ 2021-04-05 10:43 UTC (permalink / raw) To: Kai Krakow; +Cc: linux-bcache Hi. Thanks for the very clear explanation, and the various solutions provided. My SSD is a 250GB Samsung, I'll do some checking and testing, but I think I'll leave a 10% free. Happy holidays. gdb Il giorno dom 4 apr 2021 alle ore 21:42 Kai Krakow <kai@kaishome.de> ha scritto: > > Hi! > > Am So., 4. Apr. 2021 um 18:23 Uhr schrieb Giuseppe Della Bianca > <giusdbg@gmail.com>: > > In SSDs, full use of available space causes speed and durability problems. > > > > bcahe uses all the available space in the cache device? > > > > I could not find information on the maximum space used or how to set it. > > There's no option for that in bcache. Instead, create a smaller > partition for bcache, then create a second partition filling the rest > of the device. You may want to use a size ratio of 80:20 for these > partitions tho modern drives usually already have an internal reserve > area, so 90:10 may be fine, too. > > Now, use the blkdiscard command to trim the second partition. That way > the SSD knows that this is unused space it can use for wear leveling. > You may remove this second partition if you want to. In either case, > don't write anything to this space in the future. > > Now continue to install bcache to the first partition created. > > I've never seen any performance or endurance gains here using modern > Samsung drives so I've gone with using 100% for bcache. But my older > smaller drives had seen a benefit (usually better performance than > better lifetime) from using 80:20 or 90:10. So I'd say the bigger the > drive, the less likely you need to reserve any trimmed space. > > So currently I'm using a hybrid approach and made the second partition > into a big swap partition: Most of it will stay trimmed but if the > system has to swap, it will at least find fast swap space here, and it > can be used for cold hibernation. You should not do that, tho, if your > system is low on memory: Swap isn't meant as emergency memory, and it > isn't meant as an extension to installed RAM. It's a space where the > system can put anonymous memory that's never used to make space for > disk caching. Only in that case, it's hardly ever written to or read > from. > > Regards, > Kai ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-05 10:41 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-04 16:15 [CACHE DEVICE] Space usage Giuseppe Della Bianca 2021-04-04 19:41 ` Kai Krakow 2021-04-05 10:43 ` gius db
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).