You do not need sudo
to do this. You could write a script which did "df" for the starting point, and read the mount point from the output. If the mount point is not "/", then your script would recur, asking where that was mounted.
For instance, on the machine at hand, I have
$ df /var/log
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/disk/by-uuid/8a1efcd1-0d32-4674-aa7a-c24c2cd924fd 19751804 12437492 6310948 67% /
For generality, your script would have to recognize that (for this example), the disk information may be managed by LVM or udev, and getting details for that likely requires sudo
).
The case posed by OP is simpler of course. For the same machine, I have a filesystem on a disk device:
$ df /users
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 8255928 5548304 2288248 71% /users
and again, the script would only have to look at the output of "df" to see whether to finish, or recur, asking where that was mounted.