Comments (3)
Thanks for your bug report. I have to admit that I tested the script only with Ubuntu 20.04 arm64. Which OS are you using?
Maybe we can understand the problem a bit better with the output of the following commands:
- mount
- lsblk --json --discard /dev/sda
- sg_vpd -p lbpv /dev/sda
- sg_vpd -p bl /dev/sda
- sg_readcap -l /dev/sda
- ls -la /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/
from raspberry_enable_trim.
I have got it working now. But Your script didnt fully work. I did things manually.
I am using Rasbian OS on Raspberry Pi4b 4gb:
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Maybe you can check it out with a spare SD card.
Heres the output of the commands.
`sudo lsblk --json --discard /dev/sda
{
"blockdevices": [
{"name":"sda", "disc-aln":0, "disc-gran":"512B", "disc-max":"4G", "disc-zero":false,
"children": [
{"name":"sda1", "disc-aln":0, "disc-gran":"512B", "disc-max":"4G", "disc-zero":false},
{"name":"sda2", "disc-aln":0, "disc-gran":"512B", "disc-max":"4G", "disc-zero":false}
]
}
]
}
pi@raspberrypi4b:~ $ sudo sg_vpd -p lbpv /dev/sda
Logical block provisioning VPD page (SBC):
Unmap command supported (LBPU): 1
Write same (16) with unmap bit supported (LBPWS): 0
Write same (10) with unmap bit supported (LBPWS10): 0
Logical block provisioning read zeros (LBPRZ): 0
Anchored LBAs supported (ANC_SUP): 0
Threshold exponent: 0 [threshold sets not supported]
Descriptor present (DP): 0
Minimum percentage: 0 [not reported]
Provisioning type: 0 (not known or fully provisioned)
Threshold percentage: 0 [percentages not supported]
pi@raspberrypi4b:~ $ sudo sg_vpd -p bl /dev/sda
Block limits VPD page (SBC):
Write same non-zero (WSNZ): 0
Maximum compare and write length: 0 blocks [Command not implemented]
Optimal transfer length granularity: 1 blocks
Maximum transfer length: 65535 blocks
Optimal transfer length: 65535 blocks
Maximum prefetch transfer length: 65535 blocks
Maximum unmap LBA count: 20971520
Maximum unmap block descriptor count: 1
Optimal unmap granularity: 0 blocks [not reported]
Unmap granularity alignment valid: false
Unmap granularity alignment: 0 [invalid]
Maximum write same length: 0 blocks [not reported]
Maximum atomic transfer length: 0 blocks [not reported]
Atomic alignment: 0 [unaligned atomic writes permitted]
Atomic transfer length granularity: 0 [no granularity requirement
Maximum atomic transfer length with atomic boundary: 0 blocks [not reported]
Maximum atomic boundary size: 0 blocks [can only write atomic 1 block]
pi@raspberrypi4b:~ $ sudo sg_readcap -l /dev/sda
Read Capacity results:
Protection: prot_en=0, p_type=0, p_i_exponent=0
Logical block provisioning: lbpme=0, lbprz=0
Last LBA=500118191 (0x1dcf32af), Number of logical blocks=500118192
Logical block length=512 bytes
Logical blocks per physical block exponent=0
Lowest aligned LBA=0
Hence:
Device size: 256060514304 bytes, 244198.3 MiB, 256.06 GB
pi@raspberrypi4b:~ $ ls -la /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/
total 0
drwxr-xr-x 3 root root 0 Aug 28 15:34 .
drwxr-xr-x 3 root root 0 Aug 28 15:34 ..
-rw-r--r-- 1 root root 4096 Aug 29 12:35 allow_restart
-r--r--r-- 1 root root 4096 Aug 29 12:35 app_tag_own
-rw-r--r-- 1 root root 4096 Aug 29 12:35 cache_type
lrwxrwxrwx 1 root root 0 Aug 29 12:35 device -> ../../../0:0:0:0
-r--r--r-- 1 root root 4096 Aug 29 12:35 FUA
-rw-r--r-- 1 root root 4096 Aug 29 12:35 manage_start_stop
-rw-r--r-- 1 root root 4096 Aug 29 12:35 max_medium_access_timeouts
-rw-r--r-- 1 root root 4096 Aug 29 12:35 max_retries
-rw-r--r-- 1 root root 4096 Aug 29 12:35 max_write_same_blocks
drwxr-xr-x 2 root root 0 Aug 29 12:35 power
-r--r--r-- 1 root root 4096 Aug 29 12:35 protection_mode
-rw-r--r-- 1 root root 4096 Aug 29 12:35 protection_type
-rw-r--r-- 1 root root 4096 Aug 28 15:34 provisioning_mode
lrwxrwxrwx 1 root root 0 Aug 28 15:34 subsystem -> ../../../../../../../../../../../../../../../class/scsi_disk
-r--r--r-- 1 root root 4096 Aug 29 12:35 thin_provisioning
-rw-r--r-- 1 root root 4096 Aug 28 15:34 uevent
-rw-r--r-- 1 root root 4096 Aug 29 12:35 zeroing_mode
-r--r--r-- 1 root root 4096 Aug 29 12:35 zoned_cap
pi@raspberrypi4b:~ $
`
from raspberry_enable_trim.
I even got permission denied when I executed the sudo command manually.
sudo echo unmap > /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/provisioning_mode
This command would not work if it is run using non-privileged user account due to the fact that the output redirection( > /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/provisioning_mode
) is done by the current shell that is run as the regular user, not root.)
This particular mistake could be solved by running the entire command including the output redirection in a sub-shell as root, id. est.:
sudo sh -c 'echo unmap > /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/provisioning_mode'
I hope that helps.
from raspberry_enable_trim.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raspberry_enable_trim.