How to get space used and unused for all partitions?

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

How to get space used and unused for all partitions?

Post by arivas_2005 »

Greetings

I can't find a command (or a mini-script) to list the used and unused space of all partitions, mounted or not. (as gparted ... show the used or unused space for each partition in disk)
something like it is not shown space used, not used, only total.
the commands I have checked are: lsblk, fdisk, parted, disktype; but they don't show used spaces. And df and du need to mount the partition first.

Thanks!

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: get space used and unused for all partitions (and all disks in pc)

Post by puppy_apprentice »

There is tool in tray for this.

User avatar
cobaka
Posts: 572
Joined: Thu Jul 16, 2020 6:04 am
Location: Central Coast, NSW - au
Has thanked: 94 times
Been thanked: 63 times

Re: get space used and unused for all partitions (and all disks in pc)

Post by cobaka »

@arivas_2005

'df' will get you some of the way there - but will not list info about unmounted drives.

On my terminal I can type: df >> /mnt/home/zTmp/p_space.txt
zTmp is a folder in my home directory (and that is also /mnt/sda3/)
The command created a text file: p_space.txt
When I open p_space.txt with Geany I see:

Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 4526108 260736 4265372 6% /initrd/mnt/tmpfs
unionfs 210616688 25252304 174612384 13% /
/dev/loop0 195584 195584 0 100% /initrd/pup_ro2
/dev/loop1 19968 19968 0 100% /initrd/pup_f
/dev/loop2 24064 24064 0 100% /initrd/pup_z
/dev/loop3 21504 21504 0 100% /initrd/pup_a
/dev/sda3 210616688 25252304 174612384 13% /initrd/mnt/dev_save
tmpfs 5220 4708 512 91% /initrd/files
devtmpfs 4133300 0 4133300 0% /dev
shmfs 1989044 0 1989044 0% /dev/shm
/dev/loop4 284672 284672 0 100% /initrd/pup_ro3
/dev/sda2 165258464 886440 155924024 1% /mnt/sda2
/dev/sda4 581150864 17418524 534158300 4% /mnt/sda4

Helps to use a mono-spaced font, but you can see the result.

or just type du <enter> from the terminal prompt.
Remember ctrl+l will clear the screen.
'up-arrow' will restore the last command you entered. You can edit the command line (using the arrow keys) and then tap <enter>

another command to try: df

Good luck
cobaka

Puppy Linux: A thinking man's best friend ....
Puppy Linux: Trust-worthy, reliable, friendly ...

собака --> это Русский --> a dog
"c" -- say "s" - as in "see" or "scent" or "sob".

arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: get space used and unused for all partitions (and all disks in pc)

Post by arivas_2005 »

Thanks for the prompt response.

just comment that I'm looking for something to see used and unused space of all partitions at once .. without mounting.
for example ... a disk with 7 partitions ... see at once the sizes, and used and free spaces of each one without having to mount them first.

A summary like the one shown by gparted (size: used, not used, total) but in the console ... only as information.

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: get space used and unused for all partitions (and all disks in pc)

Post by puppy_apprentice »

Try Partview

BTW: there is a problem with this tool. SR0 is a internal read-only flash memory of Huawei USB modem and is only 11MB. Or maybe it has only 11MB partition?

Attachments
11MB not 4.1GB
11MB not 4.1GB
sr0.jpg (16.71 KiB) Viewed 1373 times
You can launch it from tray bar too
You can launch it from tray bar too
partview.jpg (39.77 KiB) Viewed 1375 times
arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: get space used and unused for all partitions (and all disks in pc)

Post by arivas_2005 »

Thanks puppy_apprentice

a question.
Partview mount partition before using df?
(and obviously then disassembles it I guess!)

Thank you again

User avatar
Keef
Posts: 277
Joined: Tue Dec 03, 2019 8:05 pm
Has thanked: 3 times
Been thanked: 75 times

Re: get space used and unused for all partitions (and all disks in pc)

Post by Keef »

Image

Attachments
Screenshot.png
Screenshot.png (120.11 KiB) Viewed 1354 times
User avatar
Flash
Moderator
Posts: 978
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 51 times
Been thanked: 127 times

Re: How to get space used and unused for all partitions?

Post by Flash »

I think sr0 is probably an optical disk drive. Anyway, that's what it has always been for all Puppys in my system. If there is no disk in the drive with a recognizeable filesystem, Puppy won't see anything there.

Chaos coordinator :?
User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: How to get space used and unused for all partitions?

Post by puppy_apprentice »

SR0 has CD icon (in Windows too) but it is a read-only flash memory (seeing by system like finished CD). But Puppy Slacko Partview app shows wrong capacity. I will check this in Bionic 8.0.

Attachments
sr0-rox.jpg
sr0-rox.jpg (56.46 KiB) Viewed 1329 times
User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: get space used and unused for all partitions (and all disks in pc)

Post by BarryK »

Keef wrote: Tue Dec 29, 2020 8:31 pm

Image

@Keef
Is that Partview in EasyOS or EasyPup?

Partview in Easy shows all partitions, mounted or unmounted, however, there are some Partview variants that only show mounted partitions -- I seem to recall that anyway.

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: How to get space used and unused for all partitions?

Post by puppy_apprentice »

Some tests for Bionic 7.9.8 (64bit) part1

Attachments
Bionic-partview-with-modem.png
Bionic-partview-with-modem.png (128.15 KiB) Viewed 1159 times
Bionic-partview-no-modem.png
Bionic-partview-no-modem.png (201.93 KiB) Viewed 1159 times
Bionic-icons.jpg
Bionic-icons.jpg (31.99 KiB) Viewed 1159 times
User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: How to get space used and unused for all partitions?

Post by puppy_apprentice »

Some tests for Bionic 7.9.8 (64bit) part2

Attachments
Bionic-pmount.png
Bionic-pmount.png (192.22 KiB) Viewed 1159 times
User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: How to get space used and unused for all partitions?

Post by puppy_apprentice »

Some tests for Slacko 6.3.2 (64bit)

Edit: Those all tools and icon tool-tips should show the same info for proper drives.

Attachments
Slacko-pmount.jpg
Slacko-pmount.jpg (34.95 KiB) Viewed 1159 times
Slacko-partview.jpg
Slacko-partview.jpg (36.92 KiB) Viewed 1159 times
Slacko-icons.jpg
Slacko-icons.jpg (24.67 KiB) Viewed 1159 times
Last edited by puppy_apprentice on Wed Dec 30, 2020 11:14 pm, edited 1 time in total.
User avatar
Keef
Posts: 277
Joined: Tue Dec 03, 2019 8:05 pm
Has thanked: 3 times
Been thanked: 75 times

Re: How to get space used and unused for all partitions?

Post by Keef »

@BarryK
It is in EasyOS.

User avatar
ETP
Posts: 104
Joined: Mon Jul 20, 2020 8:21 pm
Location: UK
Has thanked: 20 times
Been thanked: 101 times

Re: How to get space used and unused for all partitions?

Post by ETP »

Here Partview colours have been modified for use with a dark theme.

Attachments
partview.png
partview.png (190.45 KiB) Viewed 1111 times
Regards ETP
Current go-to Pup since Feb 2019 - BionicPup64 8.0
Video - https://photos.app.goo.gl/HYLupyMGcQFP81z69

On test - Ubuntu Cinnamon Remix 20.10 (Groovy Gorilla)
Video - https://photos.app.goo.gl/xGbQYtioXt6mzoi48
Post Reply

Return to “Programming”