Is it possible to find out the USED disk space for an UNMOUNTED file system/disk?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Once again, since this doesn't seem to be well understood or agreed upon. The attached image is one of those Western Digital My Passport drives, about 1TB. I have not put much on it yet. It is not mounted. Gparted knows how much space is used in that NTFS file system.
I haven't worked building gparted but I'll suspect that it does mount the drive for "exclusive" or "locked" use.
It does scan the drive.
There is no way it could do the things it does without doing that.
It is not in the traditional used phrase of "mount".
Well, considering that there are is an entire computer science dedicated to obscuring it, I guess it would be most accurate to say, "It depends."
Is the system encrypted? If yes, then no, unless you can the break the encryption.
I haven't worked building gparted but I'll suspect that it does mount the drive for "exclusive" or "locked" use.
It does scan the drive.
There is no way it could do the things it does without doing that.
For "that" == "scan the drive", of course it does that. For "that" == "mount the filesystem", sorry, but no. In fact, much of what gparted does (resizing or moving filesystems) requires that the filesystem not be mounted. Why is it so hard to imagine that some of the same code that exists in the kernel for parsing filesystem structures might also exist in other programs. Actually, gparted is just a front end for parted. The filesystem-specific stuff is in libparted.
It's not hard to run gparted (or parted) under strace and note the lack of any use of the mount(2) system call.
Did you look at gparted or parted to see how it calls the drive????
OK, if you insist. Looking at the output from "strace -f -e trace=file,desc gparted /dev/vda" (where /dev/vda is a virtual disk with one partition, formatted ext3), I see an open("/dev/vda1",...) followed by a lot of llseek() and read() calls near the beginning and end of the partition looking something to identify the filesystem type and fetching the filesystem super block. At no time does the filesystem get mounted. That strace expression selects all system calls that take a file name or involve a file descriptor number.
There's really no mystery at all. It's a storage device. It contains data that can be read and analyzed. There is no point in asking the kernel to mount a (possibly badly broken) filesystem.
Terminology. It may not have used mount command but it did mount the drive. This is what I was talking about earlier. We still have lost the OP long ago.
Terminology. It may not have used mount command but it did mount the drive. This is what I was talking about earlier.
In this context, "mount" has a very specific meaning and refers to attaching a filesystem to a point in the system's directory hierarchy. In your view, "dd" also "mounts" the filesystem (i.e., calls open() on the device). This is not Alice in Wonderland, where you can claim that words have any meaning that you choose.
"4.3Computing Make (a disk or disk drive) available for use."
It was made available for use by the program gparted.
It is clear to me that it conforms to the definition.
You will find that counter to what just about everyone else here means when they talk about a drive being "mounted" or not, but go ahead and enjoy your definition.
Not available, to `cp` &relatives anyway. `man -s 2 mount` gets very upset
if you attempt to speak English, instead of machine, language to a CPU
"Look inside", search (Section) 4.2.3 $35penalty
Not available, to `cp` &relatives anyway. `man -s 2 mount` gets very upset
if you attempt to speak English, instead of machine, language to a CPU
"Look inside", search (Section) 4.2.3 $35penalty
All member-created content should be in English. This allows our moderators to ensure all content complies with all LQ rules. In addition, we recommend you avoid sms/l33t speak in the technical fora. Avoiding sms/l33t speak will improve question clarity and increase the chance of receiving a helpful response.
Maybe English is not your first language but please consider composing a quality response without any shorthand or personal representations so that everyone can understand your response in that anyone can possibly contribute too your post(s).
While recommendation of using a commercial product is not against the rules but we do have loads of free information that could be referenced that would allow everyone access too.
Simple DuckDuckgo search provided this link that should provide some help to members to facilitate the operations requested;
You will find that counter to what just about everyone else here means when they talk about a drive being "mounted" or not, but go ahead and enjoy your definition.
Indeed. "Mounted," in all common usage that I have ever known, very specifically refers to "the mount command," which causes the contents of the drive (partition) to be made available as part of the overall file system.
Many programs, including the grub(2) boot loader, know how to read filesystems. The formats are entirely public, as is the source-code used within those filesystems' drivers. It is therefore possible to craft an external program, if you are so inclined, which supports every nuance of the on-disk format exactly.
This is an extremely useful capability for a program to have. Nonetheless, it is not what is universally understood to be meant by the term, "mounted."
For a program like gparted to be successful, it is crucial that the drive/partition in question must not be "mounted," so that a filesystem cannot possibly be accessing it while the utility program does.
Last edited by sundialsvcs; 04-13-2017 at 05:14 PM.
I've used many OS's and mount has referred to any use of a media. Raw drives and other devices mounted didn't use mount command but made them available. Guess I've been doing this stuff too long and on too many things.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.