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
Document future Debian/Ubuntu build time dependency in README (!121)
When preparing the GParted Live 1.6.0 distribution, which is based on
Debian unstable ("sid"), compiling GParted failed like this:
$ make
...
/usr/bin/msgfmt --desktop --template gparted.desktop.in -d ./po -o gparted.desktop
chmod +x gparted
/usr/bin/msgfmt --xml --template org.gnome.gparted.policy.in -d ./po -o org.gnome.gparted.policy
/usr/bin/msgfmt: cannot locate ITS rules for org.gnome.gparted.policy.in
make[3]: *** [Makefile:1060: org.gnome.gparted.policy] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
make[2]: *** [Makefile:618: all-recursive] Error 1
make[2]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
make[1]: *** [Makefile:452: all] Error 2
make[1]: Leaving directory '/root/gparted/gparted-1.6.0-beta1'
dh_auto_build: error: make -j16 returned exit code 2
make: *** [debian/rules:9: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit
status 2
debuild: fatal error at line 1184:
dpkg-buildpackage -us -uc -ui failed
This was also previously reported in the GParted Forum [1]. Future
Debian 13 ("trixie") and Ubuntu 24.04 LTS ("nobel") releases have moved
the needed gettext translation rules for .policy XML files:
/usr/share/gettext/its/policy.its
/usr/share/gettext/its/policy.loc
to new package libpolkit-gobject-1-dev not installed by default.
Document this new build time dependency.
Also see commits [2][3] where the equivalent change was needed in the
Alpine Linux and CentOS continuous integration images.
[1] GParted forum / [SOLVED] Unable to build "msgfmt: cannot locate ITS
rules for org..."
http://gparted-forum.surf4.info/viewtopic.php?id=18136
[2] 57ae8f888bb6f5fb8f06177a478a2374f07ee33c
Fix .policy file translation failure in Alpine Linux CI image (!107)
[3] 8450d8c6056a79508bdb91517eb4d8c5dc60fb35
Fix .policy file translation failure in CentOS CI image (!107)
Closed !121 - Document future Debian/Ubuntu build time dependency in
README