Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
1
answers
69
views
Crop pdf removing content cropped away
I do have a pdf that contains a drawing, a part of which I would like to extract. I am able to open the pdf in inkscape. However, it contains a group with 150k items. As far as I see, there are no subgroups that I could select as entity. Now just trying to select the parts that I would like to delet...
I do have a pdf that contains a drawing, a part of which I would like to extract.
I am able to open the pdf in inkscape. However, it contains a group with 150k items. As far as I see, there are no subgroups that I could select as entity. Now just trying to select the parts that I would like to delete does not work (inkscape still has 100% CPU load after 3 hours).
Is there a command line tool that would allow me to crop the pdf *and* to delete the elements that are outside the cropped area? This would then allow me to further edit the extracted section using inkscape.
user52366
(221 rep)
Jul 5, 2025, 01:12 PM
• Last activity: Jul 5, 2025, 01:43 PM
0
votes
1
answers
5632
views
Debian - Create new partition with fdisk and set size ( Last sector )
please could someone help me with my problem of create new disk partition in Debian ? I'am using Proxmox where I have created a few virtual machines. On one of virtual machines where have installed Linux - Debian I have problem with enough free disk space. So I decied that I created new partion on d...
please could someone help me with my problem of create new disk partition in Debian ?
I'am using Proxmox where I have created a few virtual machines.
On one of virtual machines where have installed Linux - Debian I have problem with enough free disk space.
So I decied that I created new partion on disk just for backup files.
**Step 1.**
I resized disk in Proxmox from 100GB to 250GB
**Step 2.**
I logged in to the Debian where I would want to create new partition for storage backup files . Partition shoud have 70GB
**Step 3.**
I run fdisk to create new partition + I'am attaching screenshot (create-new-partion-fdisk.jpg ) where I mark up few command and option that I select, but I have problem that I can't set size of partition to 70GB (+70G). I when i try it set value "+70G" for "Last Selector" question I get Error "Value out of range"
----------
Please could you help me how I can achieve this the most easy way ? I don't have such experience with Debian so if some kind soul would help me I would be glad for that ! Specific commands would be extremely halpful
Thank you !

Filip Skřivánek
(1 rep)
Jun 26, 2022, 10:04 AM
• Last activity: Jun 25, 2025, 05:07 PM
6
votes
1
answers
703
views
How to find files by size that are not divisible by 4096 and round them up
In Linux in a Folder there are many files, all created with `fallocate` with random size. How to find files whose size is not divisible by 4096 and correct the filesize (rounded up) to a multiple of 4096? They can be found with : find . -type f -printf '%s\t%p\n' | awk -F'\t' '{size=$1; file=$2; if...
In Linux in a Folder there are many files, all created with
fallocate
with random size.
How to find files whose size is not divisible by 4096 and correct the filesize (rounded up) to a multiple of 4096?
They can be found with :
find . -type f -printf '%s\t%p\n' | awk -F'\t' '{size=$1; file=$2; if (size % 4096 != 0) print file}'
But how to size them up that the filesize is divisible by 4096 ?
Banana
(189 rep)
Jun 16, 2025, 01:34 AM
• Last activity: Jun 16, 2025, 11:29 PM
0
votes
1
answers
820
views
Raid5 mdadm array change size
I have created a raid5 array with 4 disks. Initially i had 3x 3tb and 1x 4tb (because 3tb was unavailable at the time). After some years i have replaced most of these disks and have come to the point where all array disks are now 4tb in size. Still my mdadm array is 3TB. Is there any way to change t...
I have created a raid5 array with 4 disks. Initially i had 3x 3tb and 1x 4tb (because 3tb was unavailable at the time). After some years i have replaced most of these disks and have come to the point where all array disks are now 4tb in size. Still my mdadm array is 3TB.
Is there any way to change the mdadm array size to match the 4tb disk size w/o loosing my data?
Thanks for your help!
jack
(101 rep)
Aug 30, 2020, 09:00 PM
• Last activity: Jun 7, 2025, 03:17 PM
2
votes
1
answers
4180
views
How to increase size of root?
Here is information regarding my disk space consumption. Command (m for help): p Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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 typ...
Here is information regarding my disk space consumption.
Command (m for help): p
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0x360c373e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 17577983 17575936 8.4G 83 Linux
/dev/sda2 17580030 976771071 959191042 457.4G 5 Extended
/dev/sda5 17580032 23437311 5857280 2.8G 83 Linux
/dev/sda6 23439360 47773695 24334336 11.6G 82 Linux swap / Solaris
/dev/sda7 47775744 48553983 778240 380M 83 Linux
/dev/sda8 48556032 976771071 928215040 442.6G 83 Linux
But Gparted is not able to change (shrink) the size of home!
My tmp was full and my root is low on space. I used
sudo apt-get clean
In fact, I transferred the docs from root to home as a workaround.
What are the alternatives? I want to end this by increasing root size but can't able to do it. This is what Gparted shows me:

Love Grover
(401 rep)
Jan 12, 2017, 06:36 PM
• Last activity: May 6, 2025, 09:10 PM
47
votes
3
answers
123276
views
How can I make 'ps' command show memory in MB instead of KB?
The Linux [`ps`][1] command shows different memory usages like RSS ([resident set size][2]), size in kB by default. Is there a way to show in MB or GB, like `ls -s --human-readable` does? [1]: https://linux.die.net/man/1/ps [2]: https://en.wikipedia.org/wiki/Resident_set_size
The Linux
ps
command shows different memory usages like RSS (resident set size ), size in kB by default. Is there a way to show in MB or GB, like ls -s --human-readable
does?
balki
(4717 rep)
Jun 21, 2017, 02:40 AM
• Last activity: Apr 28, 2025, 09:22 AM
6
votes
2
answers
1780
views
the filesystem root has only 500MB
I am on Debian 12 and today while i was installing Davinci Resolve it happened that the following notification appeared the filesystem root has only 500MB though I have about 400GB I don't actually understand how linux uses that space and i now feel like my compute might be in danger , and i fear no...
I am on Debian 12 and today while i was installing Davinci Resolve it happened that the following notification appeared
the filesystem root has only 500MB
though I have about 400GB
I don't actually understand how linux uses that space
and i now feel like my compute might be in danger , and i fear not being able to install something in the future
could anybody tell me how to manage my space usage
i used the current command to make sure i understand things well
$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 104M 1 loop /snap/core/16928
loop2 7:2 0 73.9M 1 loop /snap/core22/1722
loop3 7:3 0 73.9M 1 loop /snap/core22/1663
loop4 7:4 0 66.2M 1 loop /snap/core24/490
loop5 7:5 0 104.2M 1 loop /snap/core/17200
loop6 7:6 0 66.2M 1 loop /snap/core24/609
loop7 7:7 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop8 7:8 0 448.6M 1 loop /snap/telegram-desktop/6470
loop9 7:9 0 44.4M 1 loop /snap/snapd/23545
loop10 7:10 0 448.6M 1 loop /snap/telegram-desktop/6474
loop11 7:11 0 44.3M 1 loop /snap/snapd/23258
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 27.9G 0 part /
├─nvme0n1p3 259:3 0 7.5G 0 part [SWAP]
└─nvme0n1p4 259:4 0 441G 0 part /home
though i really don't understand anything from that output
update:
output from
df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.8G 0 3.8G 0% /dev
tmpfs 769M 2.3M 766M 1% /run
/dev/nvme0n1p2 28G 26G 308M 99% /
tmpfs 3.8G 1.1M 3.8G 1% /dev/shm
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
/dev/loop5 105M 105M 0 100% /snap/core/17200
/dev/loop4 67M 67M 0 100% /snap/core24/490
/dev/loop0 128K 128K 0 100% /snap/bare/5
/dev/loop7 92M 92M 0 100% /snap/gtk-common-themes/1535
/dev/loop2 74M 74M 0 100% /snap/core22/1722
/dev/loop1 104M 104M 0 100% /snap/core/16928
/dev/loop6 67M 67M 0 100% /snap/core24/609
/dev/loop3 74M 74M 0 100% /snap/core22/1663
/dev/nvme0n1p4 434G 25G 387G 7% /home
/dev/loop8 449M 449M 0 100% /snap/telegram-desktop/6470
/dev/loop10 449M 449M 0 100% /snap/telegram-desktop/6474
/dev/loop9 45M 45M 0 100% /snap/snapd/23545
/dev/loop11 45M 45M 0 100% /snap/snapd/23258
/dev/nvme0n1p1 511M 5.9M 506M 2% /boot/efi
tmpfs 769M 2.5M 766M 1% /run/user/1000
output of
sudo du -mx -d 1 / | sort -n
1 /.cache
1 /lost+found
1 /media
1 /mnt
1 /snap
1 /srv
1 /tmp
12 /etc
137 /boot
1410 /root
6540 /opt
7294 /var
10845 /usr
26235 /
update: jan 21 2025
after i read all the comments and realized how complicated , hard to get and very expensive time this is going to take
i am going to get all my important stuff out and reinstall debian
the only left thing is to know the best partition these days to not get into that again in the future
do you guys suggest anything special about that ?
Bomber King
(81 rep)
Jan 19, 2025, 09:57 PM
• Last activity: Jan 20, 2025, 10:34 PM
6
votes
1
answers
7996
views
tmux not splitting panes with desired percentage size
I am trying to create a script that launches tmux with a specific pane layout and size. I am following the tutorial in the following link: https://leanpub.com/the-tao-of-tmux/read#pane-resizing However when I try to use `tmux split-window -p 75` it's more like a 40%/60% split. I've also tried `tmux...
I am trying to create a script that launches tmux with a specific pane layout and size. I am following the tutorial in the following link:
https://leanpub.com/the-tao-of-tmux/read#pane-resizing
However when I try to use
tmux split-window -p 75
it's more like a 40%/60% split. I've also tried tmux split-window -p 90
to see if I could get a bigger, and more evident, difference in size between the two panes but it doesn't change much.
These is the code that I am using:
#!/bin/sh
tmux new -s abc -d
tmux split-window -p 90
tmux attach -t abc
I know how to create the layout that I want but my problem is getting the pane sizes that I need.
potato
(453 rep)
Feb 25, 2020, 11:50 PM
• Last activity: Jan 1, 2025, 11:39 AM
5
votes
1
answers
305
views
tar having much larger size than the containing files, can I make it smaller?
On Linux Mint 22, I created both GNU, and POSIX versions of `tar`s containing 2 small files with: ```none $ tar --posix -cf archive-posix.tar auto-fan-control.cpp Makefile $ tar -cf archive-gnu.tar auto-fan-control.cpp Makefile ``` ```none $ file *.tar archive-gnu.tar: POSIX tar archive (GNU) archiv...
On Linux Mint 22, I created both GNU, and POSIX versions of
tar
s containing 2 small files with:
$ tar --posix -cf archive-posix.tar auto-fan-control.cpp Makefile
$ tar -cf archive-gnu.tar auto-fan-control.cpp Makefile
$ file *.tar
archive-gnu.tar: POSIX tar archive (GNU)
archive-posix.tar: POSIX tar archive
***
Surprisingly, the tar
s are equally of **10240** size while my files are much smaller:
$ \ls -l *.tar
-rw-rw-r-- 1 vlastimil vlastimil 10240 Dec 22 10:41 archive-gnu.tar
-rw-rw-r-- 1 vlastimil vlastimil 10240 Dec 22 10:40 archive-posix.tar
$ \ls -l auto-fan-control.cpp Makefile
-rw-rw-r-- 1 vlastimil vlastimil 863 Dec 22 01:10 auto-fan-control.cpp
-rw-rw-r-- 1 vlastimil vlastimil 1323 Dec 22 09:48 Makefile
i.e. my files are totalling just **2186** bytes, which in contrast to both tar
s that occupy 10240 bytes exactly, cannot be simply justified by including some metadata, like CRC and such. IMHO, there has to be some kind of _padding_ if I called it correcly.
So, just to be clear, this question's answers DO NOT answer mine: https://unix.stackexchange.com/q/557435/126755
***
Thinking out loud, it appears the minimum size of tar
is 10240, or its multiples, am I correct?
If I am right, just out of curiosity, is there anything I can do about it to make tar
smaller?
Thank you.
Vlastimil Burián
(30505 rep)
Dec 22, 2024, 10:51 AM
• Last activity: Dec 22, 2024, 11:50 AM
0
votes
1
answers
184
views
Cannot resize a partition with Gparted below "Minimum size"
I used `gparted` to resize a partition successfully, but it does not allow me to shrink it as much as I would actually like. I think it's because of the _Minimum size_. [![enter image description here][1]][1] Is there a possibility to reduce the _Minimum size_ value to shrink the partition further t...
I used
Is there a possibility to reduce the _Minimum size_ value to shrink the partition further than currently allowed?
@Ferrybig:
@oldfred:
sudo parted -L
@Tom Yan:
It says: Failed to find physical volume "/dev/nvme0n1p3".
Correct: I have LVM on LUKS. But I managed to reduce to Minimum size.
You write: You might need to shrink the PV....
Can you provide a link or explain in detail.
Thanks a lot
gparted
to resize a partition successfully, but it does not allow me to shrink it as much as I would actually like.
I think it's because of the _Minimum size_.



Vik
(101 rep)
Dec 4, 2024, 09:37 AM
• Last activity: Dec 11, 2024, 09:08 AM
1
votes
1
answers
375
views
Changing the partition of a Linux in VirtualBox
I have an Ubuntu system as a virtual system on VirtualBox. It uses VHD as its hard disk. I managed to change the size of VHD using VHD resizer. Now I want to expand the partition on VHD so it uses the expanded size. How can I do this?
I have an Ubuntu system as a virtual system on VirtualBox. It uses VHD as its hard disk. I managed to change the size of VHD using VHD resizer. Now I want to expand the partition on VHD so it uses the expanded size. How can I do this?
user654019
(2367 rep)
Oct 31, 2012, 11:26 AM
• Last activity: Oct 17, 2024, 08:31 AM
260
votes
14
answers
375858
views
Find the total size of certain files within a directory branch
Assume there's an image storage directory, say, `./photos/john_doe`, within which there are multiple subdirectories, where many certain files reside (say, `*.jpg`). How can I calculate a summary size of those files below the `john_doe` branch? I tried `du -hs ./photos/john_doe/*/*.jpg`, but this sho...
Assume there's an image storage directory, say,
./photos/john_doe
, within which there are multiple subdirectories, where many certain files reside (say, *.jpg
). How can I calculate a summary size of those files below the john_doe
branch?
I tried du -hs ./photos/john_doe/*/*.jpg
, but this shows individual files only. Also, this tracks only the first nest level of the john_doe
directory, like john_doe/june/
, but skips john_doe/june/outrageous/
.
So, how could I traverse the entire branch, summing up the size of the certain files?
mbaitoff
(5221 rep)
Jun 25, 2012, 04:38 AM
• Last activity: Oct 7, 2024, 01:41 PM
4
votes
1
answers
133
views
Why does "cat | wc -c" shows different size than "ls -l" for a specific file?
The distro is Ubuntu 22.04 and I'm running a newly-created `ext4` filesystem that I have copied my setup to (using rsync on a different machine). I was running a manually written (python) filesystem performance test, which worked normally on different machines. Absolutely acidentally I discovered so...
The distro is Ubuntu 22.04 and I'm running a newly-created
I thought that it is related to some filesystem corruption, and I ran fsck in recovery mode. Nothing have changed.
Then I took the disk to the machine where the rsync was originally done. (It is running Arch Linux). I mounted the Ubuntu's root partition there. Wow!
ext4
filesystem that I have copied my setup to (using rsync on a different machine). I was running a manually written (python) filesystem performance test, which worked normally on different machines. Absolutely acidentally I discovered some sort of incorrect behavior in wc
(or ls
) which manifests itself only for a particular file on my system - as far as I have discovered now - /usr/bin/pkexec
. If this is related, the box is running official Ubuntu's coreutils version 8.32-4.
This is an example of the action I'm talking about for any different file:
$ ls -l /usr/bin/top
-rwxr-xr-x 1 root root 379389 Jun 11 12:04 /usr/bin/top
$ cat /usr/bin/top | wc -c
379389
$
Note the size shown by ls and wc. It is the same.
Now, there is a file /usr/bin/pkexec
. Which is, according to man page,
pkexec - Execute a command as another user
This happens with it
$ ls -l /usr/bin/pkexec
-rwsr-xr-x 1 root root 519851 Jun 11 12:04 /usr/bin/pkexec
$ cat /usr/bin/pkexec | wc -c
32145
$
The size is different. Quite really different.
I thought that it is related to some filesystem corruption, and I ran fsck in recovery mode. Nothing have changed.
Then I took the disk to the machine where the rsync was originally done. (It is running Arch Linux). I mounted the Ubuntu's root partition there. Wow!
# ls -l /mnt/disk/usr/bin/pkexec
-rwsr-xr-x 1 root root 519851 Jun 11 12:04 /mnt/disk/usr/bin/pkexec
# cat /mnt/disk/usr/bin/pkexec | wc -c
519851
#
Here the sizes are shown equal. I do not understand. I have a different Ubuntu box with the same version where the information about the above file is this:
$ ls -l /usr/bin/pkexec
-rwsr-xr-x 1 root root 32145 Jul 26 14:45 /usr/bin/pkexec
$ cat /usr/bin/pkexec | wc -c
32145
$
The size matches here. And I see that the correct size for this file in this version of Ubuntu is "32145". But on the first machine I see sizes which don't even match each other in wc
and ls
. I had these explanations possibly
- Machines had different updates installed.
But why are the sizes shown different between utilities?
- This is some sort of runtime protection for this /usr/bin/pkexec
binary file, as I see that it's SUID - maybe OS is protecting it by showing incorrect data to users?
But why this behavior is seen only on one machine then and not the others?
Thanks for help and explanations. I think I don't understand something important about Linux.
**P.S.** The problem also exists if I read dir "/usr/bin" in some langs like Python, and retrieve metadata of files. Then I read each file and check the result length. With pkexec
- in metadata it's 519851 bytes. But if I read the file , it's much shorter - only 32145 bytes. Thanks.
melonfsck - she her
(150 rep)
Sep 16, 2024, 10:08 PM
• Last activity: Sep 18, 2024, 08:49 PM
0
votes
3
answers
96
views
What minimum linux's root partition size for virtual machine
I wanna install multiple linux distro (Ubuntu, Fedora, Manjaro, Opensusue, etc) via virtual machine (qemu) with shared /home partition for testing purposes, which i'm not gonna install anything big or lot of thing inside root partition. What is the minimum size or recommended size of root partition...
I wanna install multiple linux distro (Ubuntu, Fedora, Manjaro, Opensusue, etc) via virtual machine (qemu) with shared /home partition for testing purposes, which i'm not gonna install anything big or lot of thing inside root partition.
What is the minimum size or recommended size of root partition of each linux distro for this type of usage?
Noober
(1 rep)
May 21, 2024, 07:03 AM
• Last activity: May 21, 2024, 09:05 AM
25
votes
2
answers
47449
views
find command: -size behavior
I have a question concerning the `find` command in Linux. In all the articles I've found online it says that attribute `-size -10M`, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that `-size -10M` returns files that are less than or equal 9 MB i...
I have a question concerning the
find
command in Linux.
In all the articles I've found online it says that attribute -size -10M
, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that -size -10M
returns files that are less than or equal 9 MB in size.
If I do
find . -type f -size -1M
the find
command returns only empty files (the unit is irrelevant, it can be -1G, -1k...).
find . -type f -size -2M
returns files Bear in mind that the size is rounded up to the next unit. Therefore -size -1M is not equivalent to -size -1048576c. The former only matches empty files, the latter matches files from 0 to 1,048,575 bytes.
Ok, so I guess -1M is rounded to 0M, -2M to -1M and so on... ?
But then
find . -type f -size 1M
returns files 1M and <= 2M, etc.
Is this all normal or am I doing something wrong and what's the exact behavior of the -size
parameter?
golder3
(1194 rep)
Mar 9, 2021, 10:05 AM
• Last activity: Apr 17, 2024, 08:05 AM
0
votes
1
answers
234
views
Extend partition on RedHat VM without losing data
I have a VM with RHEL which serves as backup repo for Veeam. And now I need to extend partition for backups. * Original size was 17TB * I extended HDD in VMware to 19TB (it's a second HDD in VMware), and I restarted VM. * After restart, in `fdisk -l` output I see some information about 19TB virtual...
I have a VM with RHEL which serves as backup repo for Veeam. And now I need to extend partition for backups.
* Original size was 17TB
* I extended HDD in VMware to 19TB (it's a second HDD in VMware), and I restarted VM.
* After restart, in
fdisk -l
output I see some information about 19TB virtual disk, but the backup path is still 17 TB - /backup(/dev/mapper/vg02-backup)
Output of fdisk -l
below:
-shellsession
[root@bckrepo01 ~]# fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Disk model: Virtual disk
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: gpt
Disk identifier: 08B39BDB-49C7-4B76-BC5D-1BDCD5AA1DE5
Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 108201983 104873984 50G Linux LVM
The backup GPT table is not on the end of the device.
Disk /dev/sdb: 19 TiB, 20890720927744 bytes, 40802189312 sectors
Disk model: Virtual disk
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: gpt
Disk identifier: 952E38DA-AC78-DD44-AF19-B31C2FD62B00
Device Start End Sectors Size Type
/dev/sdb1 2048 27917287390 27917285343 13T Linux filesystem
/dev/sdb2 27917287424 36507221982 8589934559 4T Linux filesystem
Disk /dev/mapper/vg01-root: 4 GiB, 4294967296 bytes, 8388608 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
Disk /dev/mapper/vg01-swap: 8 GiB, 8589934592 bytes, 16777216 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
Disk /dev/mapper/vg01-usr: 8 GiB, 8589934592 bytes, 16777216 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
Disk /dev/mapper/vg02-backup: 17 TiB, 18691689283584 bytes, 36507205632 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
Disk /dev/mapper/vg01-tmp: 4 GiB, 4294967296 bytes, 8388608 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
Disk /dev/mapper/vg01-home: 2 GiB, 2147483648 bytes, 4194304 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
Disk /dev/mapper/vg01-var: 16 GiB, 17179869184 bytes, 33554432 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
Disk /dev/mapper/vg01-opt: 8 GiB, 8589934592 bytes, 16777216 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
[root@bckrepo01 ~]#
output below
[root@bckrepo01 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb1
VG Name vg02
PV Size <13.00 TiB / not usable 2.98 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3407871
Free PE 0
Allocated PE 3407871
PV UUID lVTuSm-GUEJ-re6D-wWWl-BOTB-tGJt-15WSXR
--- Physical volume ---
PV Name /dev/sdb2
VG Name vg02
PV Size <4.00 TiB / not usable 3.98 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1048575
Free PE 0
Allocated PE 1048575
PV UUID Xd3k9k-PHj1-3lKY-jS3W-JLPB-kP1E-QeTrl2
--- Physical volume ---
PV Name /dev/sda3
VG Name vg01
PV Size <50.01 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 12801
Free PE 1
Allocated PE 12800
PV UUID 2EnuN5-5FTY-02iZ-O8w8-G5WS-kkng-3wv5i9
Thank You for help
Rasputin
(1 rep)
Apr 11, 2024, 10:48 AM
• Last activity: Apr 13, 2024, 12:23 PM
0
votes
0
answers
102
views
Block size output from lsblk and blockdev don't match
- Why the output of LOG-SEC column and `--getbsz` in the following don't match? Are these values of different quantities? How to find actual values? And is the output of following stat command always equal to ` blockdev --getbsz`? ``` $ sudo lsblk -o NAME,PHY-SeC,LOG-SEC,FSTYPE NAME PHY-SEC LOG-SEC...
- Why the output of LOG-SEC column and
--getbsz
in the following don't match? Are these values of different quantities? How to find actual values? And is the output of following stat command always equal to blockdev --getbsz
?
$ sudo lsblk -o NAME,PHY-SeC,LOG-SEC,FSTYPE
NAME PHY-SEC LOG-SEC FSTYPE
zram0 4096 4096
nvme0n1 512 512
├─nvme0n1p1 512 512 ext4
├─nvme0n1p2 512 512 ext4
├─nvme0n1p3 512 512 ext4
├─nvme0n1p4 512 512 vfat
└─nvme0n1p5 512 512 LVM2_member
├─vgubuntu-FedoraRoot 512 512 ext4
├─vgubuntu-FedoraSwap 512 512 swap
├─vgubuntu-UbuntuSwap 512 512 swap
├─vgubuntu-UbuntuRoot 512 512 ext4
├─vgubuntu-UbuntuHome 512 512 ext4
├─vgubuntu-FedoraHome 512 512 ext4
├─vgubuntu-Data 512 512 ext4
├─vgubuntu-Documents 512 512 ext4
├─vgubuntu-Media 512 512 ext4
├─vgubuntu-Backup 512 512 ext4
└─vgubuntu-SecureCrypt 512 512 crypto_LUKS
└─Secure 512 512 ext4
$ sudo blockdev --getbsz /dev/vgubuntu/Data
4096
$ sudo blockdev --getpbsz /dev/vgubuntu/Data
512
Also,
$ stat -fc %s .
4096
From man page
- --getbsz
: Print the blocksize in bytes. This size does not describe device topology. It's the size used internally by the kernel and it may be modified (for example) by filesystem driver on mount.
- --getpbsz
: Get physical block (sector) size.
Porcupine
(2156 rep)
Apr 7, 2024, 08:44 PM
• Last activity: Apr 7, 2024, 08:54 PM
3
votes
0
answers
198
views
How can I get the height of my Title bar in bash
I am working on a pet project which involves knowing the height of the title bar on different Linux Mint PC's, I realise the size depends on the Window Title Font and probably some CSS, so it will probably change from PC to PC. I have searched for the answer, but I can't seem to nail it down, I'm su...
I am working on a pet project which involves knowing the height of the title bar on different Linux Mint PC's, I realise the size depends on the Window Title Font and probably some CSS, so it will probably change from PC to PC. I have searched for the answer, but I can't seem to nail it down, I'm sure it is easily found, but where!
I am currently running Mint 21.3 and have xdotool installed.
I am very new to Bash scripting and I'm also knocking on a fair bit, so nothing comes easy to me, but after some research and about eight hours of trial and error I have come up with this...
#!/bin/bash
sleep .05
id=$(xdotool getactivewindow)
xdotool windowmove $id 0 0
sleep .05
y=$(xprop -root '_NET_WORKAREA')
y=$(($(xwininfo -id $id|grep -oP "(?<=Absolute upper-left Y:).*") - $(echo ${y#=}|cut -d, -f2)))
read -n1 -p "Title Bar = $y"
This does actually work, I needed to add the two .05
too ensure xdotool, xprop and wininfo didn't execute too fast and cause the window move to fail and/or the result to be '0', which it occasionally did before I added them. Please let me know if there is a much much simpler way to do this, $TITLEBAR
perhaps!
I need the sleep right at the beginning of the script because the =$(xdotool getactivewindow)
gives the id of the previous window which at that point, is still the active window, I need to wait for my terminal to become the active window, my script fails 100% of the time without the sleep. Bash is very new to me so any tips and tricks are most welcome, I'll add the quotes to variables. I need the ${y#=}
to remove everything up to the "=" from my variable "y", there are probably dozens of better ways to obtain the values after the "=" but this is the only way I know. As for the readability of my script, I do tend to compact everything, (sorry about that!) The read at the end to show the result was just my way of pausing the script to see what the result was, a couple of weeks ago I couldn't even get the newbie's "Hello World" to work, it was working, but the window ran and closed in a flicker of black and I had no idea what was wrong!
I have made the alterations you advised and here is my second attempt.
#!/bin/bash
id=$(xdotool getactivewindow)
echo "Id = "$id" Wrong One!!"
sleep .08 # .05 was not quite enough, it occasionally failed.
id=$(xdotool getactivewindow)
echo -e "Id = "$id"\n"
xdotool windowmove $id 0 0
sleep .05 # Prevent xprop from giving pre-move results.
workarea=$(xprop -root "_NET_WORKAREA")
# Strip everything before the values.
workarea=${workarea#*=}
top_panel=$(echo "$workarea" | cut -d, -f2)
echo "Top Panel = "$top_panel
# Get height of top panel + header bar
y=$(xwininfo -id "$id" | grep -oP "(?<=Absolute upper-left Y:).*")
echo -e "Top panel + Header Bar ="$y"\n"
headerbar=$(( y - top_panel ))
echo "Title Bar = "$headerbar"px"
read -n1 -p "Any key to exit"
Results:
Id = 46137366 Wrong One!!
Id = 83886086
Top Panel = 32
Top panel + Header Bar = 82
Title Bar = 50px
Any key to exit
Seems like a lot of gear to find one tiny number! What is the "easy" method ??
This is an updated version of my original script.
#!/bin/bash
sleep .08 # Allow time for the active window to become this window.
id=$(xdotool getactivewindow)
# Move the window to the top of the screen so that xprop gives
# the exact size of the window header bar including top panel.
xdotool windowmove "$id" "0" "0"
sleep .05 # Allow time for xdotool to move this window.
xprop=$(xprop -root "_NET_WORKAREA")
# Cut out the desired value and trim the space before the value.
top_panel=$(echo "$xprop" | cut -d, -f2 | xargs)
# Get the size between the top of screen and the start of this window.
xwininfo=$(xwininfo -id "$id" | grep -oP "(?<=Absolute upper-left Y:).*")
headerbar=$(( xwininfo - top_panel ))
echo -e "Top panel = $top_panel""px""\nHeader Bar = $headerbar""px""\n"
# Remove the variables from memory.
unset id xprop top_panel xwininfo headerbar
read -n1 -p "Any key to exit."
This should now be getting close to what the script should be! Although, I shall still use unquoted space-less variables in my scripts, as shown in the image below, as I'm dyslexic which does make reading lines like -e "Top panel = $top_panel""px""\nHeader Bar = $headerbar""px""\n"
difficult for me to read.

Chris Fox
(31 rep)
Apr 1, 2024, 05:03 PM
• Last activity: Apr 3, 2024, 11:23 AM
0
votes
1
answers
807
views
Why is the the apparent size of a file much larger than the actual disk usage in this case? (4.4GiB vs. 512B)
While browsing folders via `ncdu`, I noticed that the apparent size of a file was sometimes much larger than the actual disk usage. Example via `ncdu`, then `a` to toggle between showing disk usage and showing apparent, then `i` to show more details: [![enter image description here][1]][1] I was tol...
While browsing folders via
I was told this may be due to some automatic process that only keeps a small portion of the data in a "fast" layer and and keeps the rest on slower place such as AWS S3. How can I check that?
---
As [suggested](https://unix.stackexchange.com/questions/771965/why-is-the-the-apparent-size-of-a-file-much-larger-than-the-actual-disk-usage-in?noredirect=1#comment1473737_771965) by [Chris Down](https://unix.stackexchange.com/users/10762/chris-down "125,094 reputation"), here is part of the output of
It seems to indicate the file isn't sparse.
As [suggested](https://unix.stackexchange.com/questions/771965/why-is-the-the-apparent-size-of-a-file-much-larger-than-the-actual-disk-usage-in#comment1473744_771965) by [Artem S. Tashkinov](https://unix.stackexchange.com/users/260833/artem-s-tashkinov "28,590 reputation"), the file system is [Lustre](https://en.wikipedia.org/wiki/Lustre_(file_system)) (checked with
ncdu
, I noticed that the apparent size of a file was sometimes much larger than the actual disk usage. Example via ncdu
, then a
to toggle between showing disk usage and showing apparent, then i
to show more details:

hexdump
run on that file:

sudo df -T
).
Franck Dernoncourt
(5533 rep)
Mar 9, 2024, 04:50 PM
• Last activity: Mar 10, 2024, 01:55 PM
9
votes
5
answers
69306
views
Can I find all files with the .log extension and order by file size?
I'm using CentOS 6.8 I'd like to know if I can I find all files with the .log extension and order by file size and display the file size next to the filename? I'm currently using this command to find all files with the .log extension: find . -name \*.log
I'm using CentOS 6.8
I'd like to know if I can I find all files with the .log extension and order by file size and display the file size next to the filename?
I'm currently using this command to find all files with the .log extension:
find . -name \*.log
bigmike7801
(311 rep)
Feb 20, 2017, 07:48 PM
• Last activity: Feb 24, 2024, 05:24 PM
Showing page 1 of 20 total questions