VM 文件系统处于只读模式

VM 文件系统处于只读模式

我有一台 VirtualBox Ubuntu VM,其中的虚拟磁盘以只读文件系统的形式挂载。我不知道为什么会这样,我尝试将其重新挂载为读/写文件系统,但没有成功。

在它变成只读之前我做的最后一件事是扩展磁盘的大小。我所做的是:

  • (来自 Mac 主机系统)用于VBoxManage modifymedium —resize扩展 VM 磁盘映像,
  • 从 GParted ISO 启动客户系统,并使用它将新空间加入到我现有的主分区中,
  • 正常启动到客户系统,然后
  • 运行lvresize并将resize2fs文件系统扩展到新的空间。

实际上,这是我第二次这样做了,而且似乎运行良好。我在机器上运行了一个占用大量空间的进程。这是我记得在遇到这个只读模式问题之前做的最后一件成功的事情。

我在 dmesg 中没有看到任何与文件系统问题或进入只读模式的原因有关的信息。我看到的是:

[    1.809918] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
[    2.230023] Adding 524284k swap on /dev/mapper/trails-swap_1.  Priority:-1     extents:1 across:524284k
[    2.242615] EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro

/proc/cmdline 显示相同的命令。

我已经尝试了 mount 命令的不同组合参数,例如:

$ sudo mount -o remount,rw

$ sudo mount -o remount,rw /dev/mapper/trails-root

$ sudo mount -o remount,rw -t ext3 /dev/sda5 /

不确定我应该寻找什么,但是我没有从这些中得到任何输出。

启动到恢复模式并执行 fsck 运行没有问题。

如果我在启动时进入 GRUB 选项并删除“ro”,我仍然会处于只读模式。

fdisk 说调整大小分区上的两个 LVM 卷不包含有效的分区表。

以下是一些可能有用的命令的输出:

$ sudo more /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/trails-root       /               ext3    errors=remount-ro 0       1
/dev/mapper/trails-swap_1       none            swap    sw              0       0
proc            /proc           proc    defaults        0       0

$ fdisk -l

Disk /dev/sda: 59.1 GB, 59055800320 bytes
255 heads, 63 sectors/track, 7179 cylinders, total 115343360 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 identifier: 0x0005deaa

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   115343359    57420801    5  Extended
/dev/sda5          501760   115343359    57420800   8e  Linux LVM

Disk /dev/mapper/trails-root: 58.3 GB, 58258882560 bytes
255 heads, 63 sectors/track, 7082 cylinders, total 113786880 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 identifier: 0x00000000

Disk /dev/mapper/trails-root doesn't contain a valid partition table

Disk /dev/mapper/trails-swap_1: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders, total 1048576 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 identifier: 0x00000000

Disk /dev/mapper/trails-swap_1 doesn't contain a valid partition table

$ sudo pvdisplay

--- Physical volume ---
PV Name               /dev/sda5
VG Name               trails
PV Size               54.76 GiB / not usable 2.81 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              14018
Free PE               0
Allocated PE          14018
PV UUID               ew9UUW-fJbf-I4o1-otM3-Rpeg-nyK6-0Hn0ol

/etc/lvm/cache/.cache.tmp: fopen failed: No space left on device

$ sudo vgdisplay

--- Volume group ---
VG Name               trails
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  9
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               54.76 GiB
PE Size               4.00 MiB
Total PE              14018
Alloc PE / Size       14018 / 54.76 GiB
Free  PE / Size       0 / 0
VG UUID               wZqfAM-DgIg-Z1P1-TSqi-iycL-O2pL-s2x8fU

Couldn't create temporary archive name.
Volume group "trails" metadata archive failed.
Couldn't create temporary archive name.
Volume group "trails" metadata archive failed.
Couldn't create temporary text file name.
Backup of volume group trails metadata failed.
/etc/lvm/cache/.cache.tmp: fopen failed: No space left on device

$ sudo lvm

lvm> lvs
  LV     VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  root   trails -wi-ao  54.26g
  swap_1 trails -wi-ao 512.00m

$ sudo lvdisplay

--- Logical volume ---
LV Name                /dev/trails/root
VG Name                trails
LV UUID                cfACOE-8PCl-jZye-dIZW-KOaS-dnOD-RwO8Ek
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                54.26 GiB
Current LE             13890
Segments               2
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:0

--- Logical volume ---
LV Name                /dev/trails/swap_1
VG Name                trails
LV UUID                EqcxJH-jOdB-NLIW-fDNi-vWn4-nWbe-feFRM6
LV Write Access        read/write
LV Status              available
# open                 2
LV Size                512.00 MiB
Current LE             128
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:1

/etc/lvm/cache/.cache.tmp: fopen failed: No space left on device

够了吗?(太多了?)

我不知道接下来该怎么办。非常感谢您的帮助!

答案1

我已经达到了 inode 限制。

$ tune2fs -l /dev/mapper/trails-root | grep -i inode

...
Inode count:     3549600
Free inodes:     0
...

相关内容