Mount

虛擬機不使用分配的磁碟空間

  • November 26, 2021

我在 Oracle VirtualBox 中執行 manjaro 來測試一組軟體的原始安裝。我收到一個錯誤,即在特定下載中沒有更多磁碟空間,但是,當我在 VirtualBox Manager 中設置 vm 時,我為其分配了足夠的空間(> 100GB)。我嘗試將其從動態分配更改為固定分區,但這並沒有解決問題。

當我執行時lsblk,這是輸出:

NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0   7:0    0 130.6M  1 loop /run/miso/sfs/livefs
loop1   7:1    0 581.9M  1 loop /run/miso/sfs/mhwdfs
loop2   7:2    0   1.5G  1 loop /run/miso/sfs/desktopfs
loop3   7:3    0 702.8M  1 loop /run/miso/sfs/rootfs
sda     8:0    0   134G  0 disk 
sr0    11:0    1   2.9G  0 rom  /run/miso/bootmnt

所以對我來說,看起來需要安裝 134gb 分區?

我跑去sudo fdisk -l看看它在哪裡:

Disk /dev/sda: 134.01 GiB, 143895691264 bytes, 281046272 sectors
Disk model: VBOX HARDDISK   
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/loop0: 130.6 MiB, 136945664 bytes, 267472 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/loop1: 581.94 MiB, 610209792 bytes, 1191816 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/loop2: 1.47 GiB, 1582903296 bytes, 3091608 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/loop3: 702.77 MiB, 736907264 bytes, 1439272 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

我正在從我的 $HOME 目錄(在本例中為/home/manjaro)執行安裝,所以我嘗試sudo mount /dev/sda /home/manjaro,這是輸出:

mount: /home/manjaro: wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.

輸出df -h

Filesystem      Size  Used Avail Use% Mounted on
dev             5.3G     0  5.3G   0% /dev
run             5.3G  114M  5.2G   3% /run
/dev/sr0        3.0G  3.0G     0 100% /run/miso/bootmnt
cowspace        256M     0  256M   0% /run/miso/cowspace
overlay_root    7.9G   79M  7.9G   1% /run/miso/overlay_root
/dev/loop0      131M  131M     0 100% /run/miso/sfs/livefs
/dev/loop1      582M  582M     0 100% /run/miso/sfs/mhwdfs
/dev/loop2      1.5G  1.5G     0 100% /run/miso/sfs/desktopfs
/dev/loop3      703M  703M     0 100% /run/miso/sfs/rootfs
overlay         7.9G   79M  7.9G   1% /
tmpfs           5.3G     0  5.3G   0% /dev/shm
tmpfs           5.3G   53M  5.3G   1% /tmp
tmpfs           5.3G  2.4M  5.3G   1% /etc/pacman.d/gnupg
tmpfs           1.1G  104K  1.1G   1% /run/user/1000

輸出mount

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=5480388k,nr_inodes=1370097,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
/dev/sr0 on /run/miso/bootmnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
cowspace on /run/miso/cowspace type tmpfs (rw,relatime,size=262144k,mode=755,inode64)
overlay_root on /run/miso/overlay_root type tmpfs (rw,relatime,size=8264028k,mode=755,inode64)
/dev/loop0 on /run/miso/sfs/livefs type squashfs (ro,relatime)
/dev/loop1 on /run/miso/sfs/mhwdfs type squashfs (ro,relatime)
/dev/loop2 on /run/miso/sfs/desktopfs type squashfs (ro,relatime)
/dev/loop3 on /run/miso/sfs/rootfs type squashfs (ro,relatime)
overlay on / type overlay (rw,relatime,lowerdir=/run/miso/sfs/livefs:/run/miso/sfs/mhwdfs:/run/miso/sfs/desktopfs:/run/miso/sfs/rootfs,upperdir=/run/miso/overlay_root/upper,workdir=/run/miso/overlay_root/work,index=off,xino=off)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12054)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=5509352k,nr_inodes=409600,inode64)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /etc/pacman.d/gnupg type tmpfs (rw,relatime,mode=755,inode64)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1101868k,nr_inodes=275467,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

輸出losetup

NAME    SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                    DIO LOG-SEC
/dev/loop1
               0      0         0  1 /run/miso/bootmnt/manjaro/x86_64/mhwdfs.sfs    0     512
/dev/loop2
               0      0         0  1 /run/miso/bootmnt/manjaro/x86_64/desktopfs.sfs
                                                                                    0     512
/dev/loop0
               0      0         0  1 /run/miso/bootmnt/manjaro/x86_64/livefs.sfs    0     512
/dev/loop3
               0      0         0  1 /run/miso/bootmnt/manjaro/x86_64/rootfs.sfs    0     512

讓我知道你的想法。謝謝。

我可以通過將驅動器安裝在主目錄內的單獨目錄中來完成這項工作。為了測試安裝,我必須把所有東西都放在這個掛載的目錄中,否則我無法訪問這個空間。所以這不是一個完美的修復,但只是為了測試一些安裝很好。總結一下:

  • 在 $HOME 中創建了一個空目錄,稱為mnt
  • 在驅動fdisk器上執行(/dev/sda在這種情況下)
  • mkfs在驅動器上跑
  • mount [drive] [destination]mount /dev/sda $HOME/mnt在這種情況下)

在此之後,該mnt文件夾可以訪問驅動器上的空間。不是最乾淨的修復,但對我的目的來說效果很好。

引用自:https://unix.stackexchange.com/questions/678615