我正在使用具有 8G 根目录的 AWS 环境,并且一开始只有 1.4G 的可用空间。
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 8.0G 6.7G 1.4G 83% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 4.0K 7.8G 1% /dev/shm
tmpfs 7.8G 17M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/xvdc1 30G 1.4G 27G 5% /data
/dev/xvdb1 30G 45M 28G 1% /appl
tmpfs 1.6G 0 1.6G 0% /run/user/601
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdb 202:16 0 30G 0 disk
└─xvdb1 202:17 0 30G 0 part /appl
xvdc 202:32 0 30G 0 disk
└─xvdc1 202:33 0 30G 0 part /data
从现在开始我需要安装许多 rpm,它们将进入/usr
。由于它在云端,我没有 root 登录,也无法安装 CD。我想我也无法启动到救援模式。
我尝试了以下方法来扩展空间,/usr
但没有成功。
调整
/dev/xvdc1
/usr 的大小并释放空间,出现逻辑卷路径无效的错误。$ sudo umount /dev/xvdb1 $ sudo e2fsck -f /dev/xvdb1 e2fsck 1.42.9 (28-Dec-2013) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/xvdb1: 13/1966080 files (0.0% non-contiguous), 167455/7864064 blocks $ sudo resize2fs /dev/xvdb1 10G resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/xvdb1 to 2621440 (4k) blocks. The filesystem on /dev/xvdb1 is now 2621440 blocks long. $ sudo lvreduce -L 10G /dev/xvdb1 "/dev/xvdb1": Invalid path for Logical Volume. Run `lvreduce --help' for more information. $ sudo lvresize -L 10G /dev/xvdb1 "/dev/xvdb1": Invalid path for Logical Volume. Run `lvresize --help' for more information. $ sudo lvreduce -L 10G /dev/xvdb/xvdb1 Volume group "xvdb" not found Cannot process volume group xvdb
按照此步骤清理
/appl
并/usr
安装/dev/xvdb1
关联,完成后,我丢失了所有命令......$ sudo rm -rf /appl/* $ sudo rsync -a /usr /appl $ sudo umount /appl $ sudo cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon May 1 18:59:01 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 / xfs defaults 0 0 /dev/xvdb1 /usr ext4 defaults 0 0 /dev/xvdc1 /data ext4 noatime 0 1 $ sudo mount /dev/xvdb1 /usr $ df -h -bash: /usr/bin/df: No such file or directory
我想知道是否有办法实现它。提前谢谢!