USB 드라이브 장치 이름에 파티션 번호가 없습니다.

USB 드라이브 장치 이름에 파티션 번호가 없습니다.

Linux는 USB 드라이브의 파티션 번호(/dev/sdX**#**)를 어떻게 결정합니까?

Linux에 연결할 때 파티션 문자를 설치하지 않는 USB 드라이브 브랜드가 있습니다. 예를 들어 다음과 같이 나타납니다./dev/sdb바꾸다/dev/sdb1. 드라이브가 포맷되었으므로 수동으로 마운트하고 /dev/sdb에 쓸 수 있습니다. 문제는 자동 마운트가 작동하지 않는다는 것입니다. 내 udev 규칙은 내 설치 규칙을 트리거하는 데 사용되지만 KERNEL=="sd[a-z]*[0-9]*", SUBSYSTEMS=="usb", ACTION=="add",RUN...실행되지 않습니다(sd[az]*로만 시도했습니다).

blkid를 실행할 때 ID_PART 매개변수가 누락되었습니다.

$ sudo blkid -o udev -p /dev/sdb
ID_FS_UUID=EED9-8A61
ID_FS_UUID_ENC=EED9-8A61
ID_FS_VERSION=FAT32
ID_FS_TYPE=vfat
ID_FS_USAGE=filesystem

내가 본 다른 모든 USB 드라이브는 다음과 같습니다.

ID_FS_UUID=932A-E6F0
ID_FS_UUID_ENC=932A-E6F0
ID_FS_VERSION=FAT32
ID_FS_TYPE=vfat
ID_FS_USAGE=filesystem
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_TYPE=0xc
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=32
ID_PART_ENTRY_SIZE=30031840
ID_PART_ENTRY_DISK=8:16

ID_PART 값은 어떻게 설정하나요? USB 자체의 정보인가요, 아니면 드라이버에서 생성된 정보인가요? 제조업체가 따르지 않는 일부 사양이 있습니까? 아니면 이것이 드라이브를 포맷하는 데 허용되는 방법입니까? 이 문제를 해결하는 데 시간을 투자해야 하는지, 아니면 내 응용 프로그램이 드라이브를 지원하지 않는 경우가 드물다는 점을 사용자에게 알릴 수 있는지 궁금합니다.

현재 Ubuntu 18.04 최소 버전을 실행 중입니다... Linux 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux, 하지만 모든 시스템에서 이 내용이 표시됩니다. 이 상황에서는 Ubuntu 14로 돌아갑니다.

이것은 이 드라이브에서 사용되는 규칙을 테스트할 때의 출력입니다. 마지막으로 실행된 작업(unshare 및 hdparm)은 내 규칙의 일부가 아니었습니다.

$ sudo udevadm test $(sudo udevadm info -q path -n /dev/sdb)
calling: test
version 237
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

Load module index
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
Reading rules file: /lib/udev/rules.d/39-usbmuxd.rules
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/40-vm-hotadd.rules
Reading rules file: /lib/udev/rules.d/50-apport.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/55-ippusbxd.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-crda.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-gnupg2.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-libsane1.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
Reading rules file: /lib/udev/rules.d/61-persistent-storage-android.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/66-snapd-autoimport.rules
Reading rules file: /lib/udev/rules.d/69-cd-sensors.rules
Reading rules file: /lib/udev/rules.d/69-libmtp.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-printers.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/71-power-switch-proliant.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/77-mm-cinterion-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-dell-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
Reading rules file: /lib/udev/rules.d/77-mm-fibocom-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-haier-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-mtk-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-sierra.rules
Reading rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-telit-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-ublox-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
Reading rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
Reading rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
Reading rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
Reading rules file: /lib/udev/rules.d/78-graphics-card.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-debian-compat.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-iio-sensor-proxy.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-mm-candidate.rules
Reading rules file: /lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib/udev/rules.d/80-udisks2.rules
Reading rules file: /lib/udev/rules.d/84-nm-drivers.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-nm-unmanaged.rules
Reading rules file: /lib/udev/rules.d/85-regulatory.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
Reading rules file: /lib/udev/rules.d/90-pulseaudio.rules
Reading rules file: /lib/udev/rules.d/95-cd-devices.rules
Reading rules file: /lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /lib/udev/rules.d/95-upower-csr.rules
Reading rules file: /lib/udev/rules.d/95-upower-hid.rules
Reading rules file: /lib/udev/rules.d/95-upower-wup.rules
Reading rules file: /lib/udev/rules.d/97-hid2hci.rules
Reading rules file: /etc/udev/rules.d/99-automount-usb.rules
Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 32795 bytes strings
24061 strings (201804 bytes), 21012 de-duplicated (172059 bytes), 3050 trie nodes used
GROUP 6 /lib/udev/rules.d/50-udev-default.rules:56
IMPORT builtin 'usb_id' /lib/udev/rules.d/60-persistent-storage.rules:47
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-4/1-4:1.0: if_class 8 protocol 6
LINK 'disk/by-id/usb-General_UDisk-0:0' /lib/udev/rules.d/60-persistent-storage.rules:52
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:73
LINK 'disk/by-path/pci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0' /lib/udev/rules.d/60-persistent-storage.rules:75
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:90
probe /dev/sdb raid offset=0
LINK 'disk/by-uuid/EED9-8A61' /lib/udev/rules.d/60-persistent-storage.rules:93
RUN '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/%k' /lib/udev/rules.d/66-snapd-autoimport.rules:3
RUN '/lib/udev/hdparm' /lib/udev/rules.d/85-hdparm.rules:1
handling device node '/dev/sdb', devnum=b8:16, mode=0660, uid=0, gid=6
preserve permissions /dev/sdb, 060660, uid=0, gid=6
preserve already existing symlink '/dev/block/8:16' to '../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fusb-General_UDisk-0:0'
creating link '/dev/disk/by-id/usb-General_UDisk-0:0' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-id/usb-General_UDisk-0:0' to '../../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0'
creating link '/dev/disk/by-path/pci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-path/pci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0' to '../../sdb'
found 'b8:16' claiming '/run/udev/links/\x2fdisk\x2fby-uuid\x2fEED9-8A61'
creating link '/dev/disk/by-uuid/EED9-8A61' to '/dev/sdb'
preserve already existing symlink '/dev/disk/by-uuid/EED9-8A61' to '../../sdb'
ACTION=add
DEVLINKS=/dev/disk/by-uuid/EED9-8A61 /dev/disk/by-id/usb-General_UDisk-0:0 /dev/disk/by-path/pci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0
DEVNAME=/dev/sdb
DEVPATH=/devices/pci0000:00/0000:00:15.0/usb1/1-4/1-4:1.0/host2/target2:0:0/2:0:0:0/block/sdb
DEVTYPE=disk
ID_BUS=usb
ID_FS_TYPE=vfat
ID_FS_USAGE=filesystem
ID_FS_UUID=EED9-8A61
ID_FS_UUID_ENC=EED9-8A61
ID_FS_VERSION=FAT32
ID_INSTANCE=0:0
ID_MODEL=UDisk
ID_MODEL_ENC=UDisk\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_MODEL_ID=1234
ID_PATH=pci-0000:00:15.0-usb-0:4:1.0-scsi-0:0:0:0
ID_PATH_TAG=pci-0000_00_15_0-usb-0_4_1_0-scsi-0_0_0_0
ID_REVISION=5.00
ID_SERIAL=General_UDisk-0:0
ID_TYPE=disk
ID_USB_DRIVER=usb-storage
ID_USB_INTERFACES=:080650:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=General
ID_VENDOR_ENC=General\x20
ID_VENDOR_ID=abcd
MAJOR=8
MINOR=16
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=1863301153
run: '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sdb'
run: '/lib/udev/hdparm'
Unload module index
Unloaded link configuration context.

`

답변1

답변의 적어도 일부를 추론할 수 있습니다.https://superuser.com/questions/1052723/format-usb-flash-drive-without-partitions

기본적으로 파티션 테이블을 생성하지 않고도 장치에서 직접 파일 시스템을 생성할 수 있습니다.

질문의 두 번째 부분은 다음과 관련이 있습니다.KERNEL=="sd[a-z]*[0-9]*", SUBSYSTEMS=="usb", ACTION=="add",RUN...

시도해 봐야 할 수도 있습니다. KERNEL=="sd[a-z]*", SUBSYSTEMS=="usb", ACTION=="add",RUN...장기적인 문제가 발생할 것이라고 확신하지만 즉시 생각할 수는 없습니다.

또는 USB 드라이브의 데이터를 백업하고, 하나의 파티션으로 파티션 테이블을 생성하고(parted를 사용하겠지만, 나이가 많고 사용 가능한 더 멋진 도구가 있을 수 있음), 파티션을 포맷하고 데이터를 다시 복사할 수 있습니다.

관련 정보