-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscsi-block_Support--unmap_writesame.txt
68 lines (64 loc) · 2.48 KB
/
scsi-block_Support--unmap_writesame.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
======Enable discard support --unmap
Setup:
Note: this case only support on passthrough scsi disk, Assume only one disk on your host, then
# modprobe scsi_debug dev_size_mb=1024 lbpu=1
# lsscsi
[16:0:0:0] disk Linux scsi_debug 0004 /dev/sdj
# cat /sys/block/sdj/device/scsi_disk/16\:0\:0\:0/provisioning_mode
unmap
# cat /sys/bus/pseudo/drivers/scsi_debug/map
<------output nothing
Step:
1.boot guest with /dev/sdb as a passthrough disk,like
...-drive file=/dev/sdj,if=none,id=hd,format=raw,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-block,bus=scsi0.0,drive=hd,id=sluo
2.in guest:
# dd if=/dev/zero of=/dev/sda bs=1M
dd: writing `/dev/sda': No space left on device
1025+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.80116 s, 383 MB/s
3.in host:
# cat /sys/bus/pseudo/drivers/scsi_debug/map
1-2097151
4.in guest:
# parted /dev/sda mklabel msdos
# parted /dev/sda mkpart primary ext2 2048s 100%
# mkfs.ext4 /dev/sda1
# mkdir /mnt/test
# mount /dev/sda1 /mnt/test
# fstrim /mnt/test
5.in host:
# cat /sys/bus/pseudo/drivers/scsi_debug/map
1-2600,2609-2616,2625-2672,2697-2704,2825-35600,264193-264208,526337-559104,788481-788496,1312769-1312784,1837057-1837072,2097145-2097151
======Enable discard support --write same
Setup:
Note: this case only support on passthrough scsi disk, Assume only one disk on your host, then
# modprobe scsi_debug dev_size_mb=1024 lbpws=1
# lsscsi
[16:0:0:0] disk Linux scsi_debug 0004 /dev/sdj
# cat /sys/block/sdj/device/scsi_disk/16\:0\:0\:0/provisioning_mode
writesame_16
# cat /sys/bus/pseudo/drivers/scsi_debug/map
<------output nothing
Steps:
1.boot guest with /dev/sdb as a passthrough disk,like
...-drive file=/dev/sdj,if=none,id=hd,format=raw,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-block,bus=scsi0.0,drive=hd,id=sluo
2.in guest:
# dd if=/dev/zero of=/dev/sda bs=1M
dd: writing `/dev/sda': No space left on device
1025+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.24017 s, 479 MB/s
3.in host:
# cat /sys/bus/pseudo/drivers/scsi_debug/map
1-2097151
4.in guest:
# parted /dev/sda mklabel msdos
# parted /dev/sda mkpart primary ext2 2048s 100%
# mkfs.ext4 /dev/sda1
# mkdir /mnt/test
# mount /dev/sda1 /mnt/test
# fstrim /mnt/test
5.in host:
# cat /sys/bus/pseudo/drivers/scsi_debug/map
1-2600,2609-2616,2625-2672,2697-2704,2825-35600,264193-264208,526337-559104,788481-788496,1312769-1312784,1837057-1837072,2097145-2097151