You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何列出逻辑卷/dev/dm-0上的文件与目录以清理空间?

Listing Files & Directories on /dev/dm-0 Logical Volume (And Freeing Up Space)

Hey there, let's get this sorted out for you! Listing content on a logical volume like /dev/dm-0 is totally feasible—you just need to work with its mount point first, since raw block devices like /dev/dm-0 can't be directly browsed like regular folders. Here's a step-by-step breakdown:

Step 1: Find where /dev/dm-0 is mounted

Logical volumes are attached to a directory on your filesystem (the mount point). To find it, run either of these commands:

  • df -h /dev/dm-0
    This will show you the exact directory /dev/dm-0 is mounted to (look for the "Mounted on" column). For example, it might output something like /mnt/data or even / if it's your root volume.
  • lsblk
    This lists all block devices with their mount points—scan for /dev/dm-0 and check the "MOUNTPOINT" field.

If /dev/dm-0 isn't mounted yet, you'll need to mount it first:

  1. Create a temporary mount directory: mkdir -p /mnt/temp_lv_mount
  2. Check the filesystem type of /dev/dm-0 with blkid /dev/dm-0 (look for the TYPE= value, e.g., ext4, xfs)
  3. Mount it: mount -t [filesystem-type] /dev/dm-0 /mnt/temp_lv_mount

Step 2: List files and directories

Once you have the mount point (let's call it /path/to/mountpoint), use standard file commands to browse and analyze the content:

  • List all files/directories (including hidden ones): ls -la /path/to/mountpoint
  • Get a summary of directory sizes (great for identifying space hogs): du -sh /path/to/mountpoint/*
  • Find large files (e.g., files over 1GB): find /path/to/mountpoint -type f -size +1G
  • Sort directories by size (to prioritize cleanup): du -h /path/to/mountpoint | sort -hr

Pro Tip for Freeing Up Space

Before deleting anything, double-check you're targeting the right files! You can use ls -lh /path/to/large-file to confirm the file size, or cat /path/to/file (for text files) to verify content. For directories, cd /path/to/directory && ls -la to see what's inside.

内容的提问来源于stack exchange,提问作者Arin Ekandem

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:49:22