gparted/src
Mike Fleetwood 81c2271311 Recognise NBDs (Network Block Devices) (#247)
Network Block Devices are not displayed in GParted as partitionable
devices.  They do appear in /proc/partitions, are reported by
fdisk -l [1] and by ped_device_probe_all() from libparted.  Therefore
include them.

Create NBD device for testing:
    # truncate -s 1G /tmp/disk-1G.img
    # nbd-server -C /dev/null 9000 /tmp/disk-1G.img
    # nbd-client localhost 9000 /dev/nbd0

After creating a couple of partitions for testing, the contents of
/proc/partitions looks like this:
    # egrep 'name|nbd' /proc/partitions
    major minor  #blocks  name
      43        0    1048576 nbd0
      43        1     262144 nbd0p1
      43        2     785408 nbd0p2

Listing all disks using fdisk:
    # fdisk -l
    ...

    Disk /dev/nbd0: 1 GiB, 1073741824 bytes, 2097152 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x081b1cd1

    Device      Boot  Start     End Sectors  Size Id Type
    /dev/nbd0p1        2048  526335  524288  256M 83 Linux
    /dev/nbd0p2      526336 2097151 1570816  767M 83 Linux

Temporarily apply this patch to GParted so that it ignores the devices it
currently selects from /proc/partitions to use what get_device_probe_all()
reports.  GParted shows NBDs.
    $ git diff --unified=1
    diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
    index 1629f94f..abea7a0b 100644
    --- a/src/GParted_Core.cc
    +++ b/src/GParted_Core.cc
    @@ -172,3 +172,3 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
            //try to find all available devices if devices exist in /proc/partitions
    -       std::vector<Glib::ustring> temp_devices = Proc_Partitions_Info::get_device_paths();
    +       std::vector<Glib::ustring> temp_devices;
            if ( ! temp_devices .empty() )

Tidy-up NBD device:
    # nbd-client -d /dev/ndb0
    # killall nbd-server
    # rm /tmp/disk-1G.img

[1] man fdisk
    "-l, --list
        List the partition tables for the specified devices and then
        exit.  If no devices are given, the devices mentioned in
        /proc/partitions (if this file exists) are used.
    "

Closes #247 - GParted does not list NBD (Network Block Device) devices
              in the GUI
2024-03-17 15:44:34 +00:00
..
BCache_Info.cc Use POSIX basename() in BCache_Info.cc (!99) 2022-04-10 08:15:16 +01:00
BlockSpecial.cc Include sys/sysmacros.h for major and minor macros (#776173) 2017-01-04 10:58:44 +00:00
CopyBlocks.cc Replace String::ucompose() with Glibmm equivalent (#46) 2019-03-27 16:45:22 +00:00
DMRaid.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Device.cc Return and use constant reference from Device::get_path() (!94) 2021-11-16 16:08:17 +00:00
DialogFeatures.cc White space tidy-up some of DialogFeatures 2021-07-30 16:12:24 +00:00
DialogManageFlags.cc Replace deprecated get_vbox() with get_content_area() (!25) 2019-04-27 12:03:05 +01:00
DialogPasswordEntry.cc Add accessibility relations (!92) 2021-10-09 08:34:41 +00:00
Dialog_Base_Partition.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Dialog_Disklabel.cc Return and use constant reference from Device::get_path() (!94) 2021-11-16 16:08:17 +00:00
Dialog_FileSystem_Label.cc Add accessibility relations (!92) 2021-10-09 08:34:41 +00:00
Dialog_Partition_Copy.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Dialog_Partition_Info.cc Extract repeated code into trim_trailing_new_line() (!105) 2022-08-25 15:41:31 +00:00
Dialog_Partition_Name.cc Add accessibility relations (!92) 2021-10-09 08:34:41 +00:00
Dialog_Partition_New.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Dialog_Partition_Resize_Move.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Dialog_Progress.cc Write file system type as "[Encrypted] FSTYPE" to saved details 2023-10-04 16:03:09 +00:00
DrawingAreaVisualDisk.cc Remove final namespace qualifiers from use of GParted's own enums 2024-02-08 16:19:20 +00:00
FS_Info.cc Extract repeated code into trim_trailing_new_line() (!105) 2022-08-25 15:41:31 +00:00
FileSystem.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Frame_Resizer_Base.cc Use Gdk::RGBA (!25) 2019-04-27 12:03:04 +01:00
Frame_Resizer_Extended.cc Use Gdk::RGBA (!25) 2019-04-27 12:03:04 +01:00
GParted_Core.cc Remove Attempt Data Rescue and use of gpart (!118) 2023-10-04 16:03:09 +00:00
HBoxOperations.cc Use Gtk::Box for HBoxOperations (!25) 2019-04-27 12:03:04 +01:00
LUKS_Info.cc Capture LUKS mapping master encryption key location (#59) 2021-04-25 15:49:35 +00:00
LVM2_PV_Info.cc Use constant reference from LVM2_PV_Info::get_vg_cache_entry_by_name() (!94) 2021-11-16 16:08:17 +00:00
Makefile.am Remove Attempt Data Rescue and use of gpart (!118) 2023-10-04 16:03:09 +00:00
MenuHelpers.cc Ensure icon sizes (#39) 2019-04-06 11:42:28 +01:00
Mount_Info.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Operation.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationChangeUUID.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationCheck.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationCopy.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationCreate.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationDelete.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationDetail.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationFormat.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationLabelFileSystem.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationNamePartition.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OperationResizeMove.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
OptionComboBox.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Partition.cc Return and use constant reference from Partition::get_mountpoints() (!94) 2021-11-16 16:08:17 +00:00
PartitionLUKS.cc Rename Partition.filesystem member to fstype (!52) 2019-12-03 13:24:44 +00:00
PartitionVector.cc Create and use general find_extended_partition() function 2017-01-14 08:49:58 -07:00
PasswordRAMStore.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
PipeCapture.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
Proc_Partitions_Info.cc Recognise NBDs (Network Block Devices) (#247) 2024-03-17 15:44:34 +00:00
ProgressBar.cc Return constant reference from ProgressBar::get_text() 2023-06-17 16:13:23 +00:00
SWRaid_Info.cc Return and use constant reference from SWRaid_Info::get_label() (!94) 2021-11-16 16:08:17 +00:00
SupportedFileSystems.cc C++11: Convert NULL to nullptr (!117) 2023-09-23 15:30:15 +00:00
TreeView_Detail.cc Return and use constant reference from Partition::get_mountpoints() (!94) 2021-11-16 16:08:17 +00:00
Utils.cc Remove Attempt Data Rescue and use of gpart (!118) 2023-10-04 16:03:09 +00:00
Win_GParted.cc Update copyright years 2024-02-26 09:15:09 -07:00
btrfs.cc Stop using floating point calculations in FS resize() methods (!119) 2023-10-29 15:50:43 +00:00
exfat.cc Fix crash when dealing with 0000-0000 exfat UUID (!115) 2023-06-24 15:48:52 +01:00
ext2.cc Refactor ext2::set_used_sectors() into if fail return early (!119) 2023-10-29 15:50:43 +00:00
f2fs.cc Drop fsck.f2fs -y option not available before f2fs-tools 1.10.0 (!29) 2019-03-26 08:08:10 +00:00
fat16.cc Stop clearing FAT16/32 label when setting a new UUID (!104) 2022-07-04 17:50:25 +00:00
hfs.cc port-to-gtk3: Rework Glibmm header includes (#7) 2019-02-11 08:57:18 +00:00
hfsplus.cc port-to-gtk3: Rework Glibmm header includes (#7) 2019-02-11 08:57:18 +00:00
jfs.cc Add missing includes into jfs.cc 2019-11-14 17:12:06 +00:00
linux_swap.cc Stop using member variables T & N in linux_swap, luks & lvm2_pv classes (!119) 2023-10-29 15:50:43 +00:00
luks.cc Stop using member variables T & N in linux_swap, luks & lvm2_pv classes (!119) 2023-10-29 15:50:43 +00:00
lvm2_pv.cc Stop using member variables T & N in linux_swap, luks & lvm2_pv classes (!119) 2023-10-29 15:50:43 +00:00
main.cc Also write "Root privileges are required ..." message to stderr (!34) 2019-04-03 20:45:31 +00:00
minix.cc Add support for minix file system (!12) 2018-08-24 20:22:08 +01:00
nilfs2.cc Refactor nilfs2::set_used_sectors() into if fail return early pattern (!119) 2023-10-29 15:50:43 +00:00
ntfs.cc Stop using floating point calculations in FS resize() methods (!119) 2023-10-29 15:50:43 +00:00
reiser4.cc Refactor reiser4::set_used_sectors() into if fail return early pattern (!119) 2023-10-29 15:50:43 +00:00
reiserfs.cc Refactor reiserfs::set_used_sectors() into if fail return early pattern (!119) 2023-10-29 15:50:43 +00:00
udf.cc Return and use constant reference from Partition::get_filesystem_label() (!94) 2021-11-16 16:08:17 +00:00
xfs.cc Refactor xfs::set_used_sectors() into if fail return early pattern (!119) 2023-10-29 15:50:43 +00:00