0

I'm working with a AWS environment with 8G root and there is only 1.4G free space at the beginning.

$ 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

Start from now I need to install many rpms which will go into /usr. Since it is on the cloud, I don't have root login nor can't mount CD. And I suppose I can't boot into rescue mode neither.

I tried the following ways to expand space for /usr but got no luck.

  • resize /dev/xvdc1 and free space for /usr, got Invalid path for Logical Volume error.

    $ 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
    
  • clear /appl and mount /usr on /dev/xvdb1 following the steps on this link, after finished, I lost all the commands...

    $ 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
    

I'm wondering whether there is a way to achieve it. Thanks in advance!

Tokoyomi
  • 1
  • 2

0 Answers0