EBS volume was attached as ext4
on /opt/apps
. There are currently no data on it. How to change filesystem type to xfs
and assign a new mount point to /data
?
[centos@ip-10-24-xx-xxx ~]$ df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 xfs 8.0G 1.4G 6.7G 17% /
devtmpfs devtmpfs 7.3G 0 7.3G 0% /dev
tmpfs tmpfs 7.2G 0 7.2G 0% /dev/shm
tmpfs tmpfs 7.2G 17M 7.2G 1% /run
tmpfs tmpfs 7.2G 0 7.2G 0% /sys/fs/cgroup
/dev/xvdb ext4 99G 61M 94G 1% /opt/apps
tmpfs tmpfs 1.5G 0 1.5G 0% /run/user/1000
This is not specific to AWS EBS. Amazon gives you a "disk" called EBS, attached to /dev/xvdb. Then, feel free to mount it anywhere (/opt/apps, or /data) and format it with the filesystem you want.
This page can help you http://ask.xmodulo.com/create-mount-xfs-file-system-linux.html
See you have two options to achieve your use case.
You can either convert your root volume to XFS or create a second volume. Personally, I would favour the latter as it offers more flexibility.
Option 1: Convert Root Volume to XFS
xfsprogs
if not already done) rsync -aHAXxSP /source /target
) The reason for attaching the root volume to another instance is to attain consistency, which would be difficult with the volume in use.
Option 2: Move data to a second EBS volume
lsof | grep /path/to/dir
lsof | grep /path/to/dir
to check for remaining write locks mount -o bind /mnt/path/to/dir /orig/path/to/dir
) /etc/fstab
file to make the mount points permanent; eg: /mnt/path/to/dir /orig/path/to/dir bind defaults,noatime,bind 0 0
Restart to ensure everything persists and functions as it should. You may also want to consider shrinking your root volume down a bit since, hopefully, it shouldn't be growing (or changing) much with all the data removed from it.
(As a point of mention, it may be possible to freeze an ext4 file system using fsfreeze
, which is included in util-linux-ng
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.