Is there any way to see the mapping commands for gnome disk operations?

Hi:

I use Gnome Disk to shrink the disk, as shown in the picture below:

The result of shrinking the partition is very smooth, and the operation through the UI is very intuitive.

But is there a way to know the actual commands corresponding to it?

Thanks

Short and simple answer is no. As @vgaetera said the calls are hidden in few library (and also few demon) layers. GNOME Disks itself uses UDisks a system demon for storage management which itself uses libblockdev which then either uses other libraries (like libfdisk for the partition resize) and calls commands (like resize2fs to resize ext4 filesystem).
If you really want to see what GNOME Disks and UDisks are doing you can try restarting the udisksd demon with strace added, but even with just execve syscall filtered to see what commands is UDisks actually running it will be really hard to read the output. But for resize it might look like this:

$ sudo strace -e trace=execve -ff /usr/libexec/udisks2/udisksd --replace --debug

strace: Process 8052 attached
[pid  8052] execve("/usr/local/sbin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f54001760 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8052] execve("/usr/local/bin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f54001760 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8052] execve("/usr/sbin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f54001760 /* 26 vars */) = 0
[pid  8052] +++ exited with 0 +++
[pid  7989] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8052, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 8056 attached
[pid  8056] execve("/usr/local/sbin/resize2fs", ["resize2fs", "/dev/loop0p1", "121673s"], 0x7f9f5400d480 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8056] execve("/usr/local/bin/resize2fs", ["resize2fs", "/dev/loop0p1", "121673s"], 0x7f9f5400d480 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8056] execve("/usr/sbin/resize2fs", ["resize2fs", "/dev/loop0p1", "121673s"], 0x7f9f5400d480 /* 26 vars */) = 0
[pid  8056] +++ exited with 0 +++
[pid  7737] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8056, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 8060 attached
[pid  8060] execve("/usr/local/sbin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f5400db00 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8060] execve("/usr/local/bin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f5400db00 /* 26 vars */) = -1 ENOENT (No such file or directory)
[pid  8060] execve("/usr/sbin/e2fsck", ["e2fsck", "-f", "-y", "-C", "1", "/dev/loop0p1"], 0x7f9f5400db00 /* 26 vars */) = 0
[pid  8060] +++ exited with 0 +++
[pid  7989] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8060, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---

so you can see it calls resize2fs /dev/loop0p1 121673 to actually resize the filesystem and also runs e2fsck before and after the resize to check the filesystem is clean (before the resize) and the resize didn’t corrupt it.

3 Likes

And after you resize the filesystem you would presumably want to move your partition boundary. I demonstrated doing this via the command line here: BTRFS partition corrupted - #22 by glb

1 Like

Hi:
thanks for your reply

Thank you.