Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1508  / 1 Year ago, wed, march 29, 2023, 3:11:08

I am using LUKS for disk encryption for a Ubuntu 18.04 system. I'd like to find out how much free space is still available on my hard drive. gparted prints the following:



enter image description here



As you can see the entire disk is subdivided into three partitions. On startup LUKS tells me that the encrypted disk is called nvme0n1p3_crypt. However, there are nvme0n1p1 and nvme0n1p1 as well.




  1. Does this mean the are three partitions being all encrypted with the same key?



    The df -a -h command outputs among others the following:



    /dev/nvme0n1p2               705M  164M  490M  25% /boot
    /dev/nvme0n1p1 511M 6,1M 505M 2% /boot/efi


    Unfortunately, I cannot see the actual device which seems to be /dev/nvme0n1p3?


  2. Why doesnt't df list the encrypted disk and how can I find out the available free space?



    df /dev/nvme0n1p3 -h yields the following:



    Filesystem      Size  Used Avail Use% Mounted on
    udev 7,7G 0 7,7G 0% /dev

  3. This output seems weird, because the total available space is only 7,7G. This is not true as you can see above in the gparted output. The partition has roughly 475.75 GiB. Can you explain this?



More From » luks

 Answers
7

Does this mean the are three partitions being all encrypted with the same key?




No, this means partition is in use - aka mounted. It's not recommended to edit mounted/in-use filesystems, since data loss can occur. The third big partition is not mounted according to the column in the screenshot




Why doesnt't df list the encrypted disk and how can I find out the available free space?




df reports usage for only mounted filesystems. Filesystems that are not mounted will report usage for /dev filesystem. Here's example of mounted vs unmounted reports:



# unmount my second drive, reports usage for udev
$ udisksctl unmount -b /dev/sdb1
Unmounted /dev/sdb1.
$ df /dev/sdb1
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4000948 0 4000948 0% /dev
# statvfs call can be done on mounted filesystem, hence we see usage report
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /mnt/ubuntu.
$ df /dev/sdb1
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 115247656 100662532 8707776 93% /mnt/ubuntu


The /dev/nvme0n1p3 does not seem to have proper mountpoint (directory) and instead reports ubuntu-vg. Try the following ( source )



$ sudo mount /dev/ubuntu-vg/root /mnt
$ df -h /dev/ubuntu-vg/root


Since you're using lvm you should use sudo lvs preferably to find out what logical volumes are actually called.




This output seems weird, because the total available space is only 7,7G. This is not true as you can see above in the gparted output. The partition has roughly 475.75 GiB. Can you explain this?




It can occur when filesystem is not resized after partitioning, even with non-lvm cases. So if you have recently resized/repartitioned that device it could be the cause. Again, probably you don't wanna use df with lvm.


[#6007] Thursday, March 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breadoules

Total Points: 212
Total Questions: 118
Total Answers: 120

Location: Dominica
Member since Mon, Jun 22, 2020
4 Years ago
;