Git Product home page Git Product logo

Comments (4)

ilyapopov avatar ilyapopov commented on June 28, 2024

Suspect is get_parent_devpath_from_path function from block-utils crate.

https://github.com/cholcombe973/block-utils/blob/3906e66694df2e7330f3cabc3cf4ee218f4790b8/src/lib.rs#L1620

from fclones.

ilyapopov avatar ilyapopov commented on June 28, 2024

This is example stacktrace:

 > /usr/lib/x86_64-linux-gnu/libc-2.33.so(close+0x3b) [0x10832b]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0(udev_monitor_receive_device+0x17d8) [0x138a8]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0(udev_monitor_receive_device+0x9de2) [0x1beb2]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0() [0x71e7]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0() [0x770b]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0(udev_device_get_properties_list_entry+0x6de) [0xfb6e]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0(udev_device_get_properties_list_entry+0xb73) [0x10003]
 > /usr/lib/x86_64-linux-gnu/libudev.so.1.7.0(udev_enumerate_scan_devices+0x289) [0x114b9]
 > /home/xxx/.cargo/bin/fclones(block_utils::get_parent_devpath_from_path+0x47) [0xf14d7]
 > /home/xxx/.cargo/bin/fclones(fclones::device::DiskDevices::new+0x1dd) [0xf068d]
 > /home/xxx/.cargo/bin/fclones(fclones::group_files+0x65) [0xffbf5]
 > /home/xxx/.cargo/bin/fclones(fclones::main+0x927) [0x1769d7]
 > /home/xxx/.cargo/bin/fclones(std::sys_common::backtrace::__rust_begin_short_backtrace+0x3) [0x17b2e3]
 > /home/xxx/.cargo/bin/fclones(_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hf452a67b20fd31b4E.llvm.9150410927396584600+0x9) [0x1770b9]
 > /home/xxx/.cargo/bin/fclones(std::rt::lang_start_internal+0x305) [0x248425]
 > /home/xxx/.cargo/bin/fclones(main+0x22) [0x176c52]
 > /usr/lib/x86_64-linux-gnu/libc-2.33.so(__libc_start_main+0xd5) [0x28565]
 > /home/xxx/.cargo/bin/fclones(_start+0x2e) [0x4b0ee]

from fclones.

pkolaczk avatar pkolaczk commented on June 28, 2024

Yup, I know of this problem and it happens also on my machine. Not sure why block utils has to traverse so much. Looks weird.

Any ideas how to reliably get the physical device name knowing the partition device name on Linux?

from fclones.

ilyapopov avatar ilyapopov commented on June 28, 2024

By the way, I have found some information that may be useful.

On linux, there is lsblk utility that shows some info about block devices and partitions. I sneaked upon it with strace, and found this:

  • It enumerates /sys/block/ directory to find all block devices. Partitions are subdirectories of devices.

  • Each block device has a file dev that contains it device id, for example:

    /sys/block/nvme0n1/nvme0n1p3/dev

contains 259:3

  • To get additional information on that block device you can access directory /sys/dev/block/259:3
  • To identify the device that contains the file, you compare major (and optionally minor) device id.

This algorithm requires O(d) operations where d is a number of block devices in the system.

from fclones.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.