こんにちは。
/var のディレクトリを別の追加ディスクに移行する手順を残しておきます。
[root@test-server /]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 30G 0 disk mqvda1 253:1 0 29.3G 0 part / vdb 253:16 0 100G 0 disk
/dev/vdb の領域に /var を移行してみます。
手順
・ファイルシステムの作成
/dev/vdb にパーティションを切ってからファイルシステムを作成します。
[root@test-server /]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xf4f00fe7. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-209584127, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-209584127, default 209584127): +100G Value out of range. Last sector, +sectors or +size{K,M,G} (2048-209584127, default 209584127): ^[[A^[[D^[[B^[[B^C [root@sr-stg-ftp01 /]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x71de9846. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-209584127, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-209584127, default 209584127): Using default value 209584127 Partition 1 of type Linux and of size 100 GiB is set Command (m for help): p Disk /dev/vdb: 107.3 GB, 107307073536 bytes, 209584128 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 label type: dos Disk identifier: 0x71de9846 Device Boot Start End Blocks Id System /dev/vdb1 2048 209584127 104791040 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
mkfs -t xfs /dev/vdb1
・シングルユーザモードへ
init 1
・追加ディスクをアタッチして/var を同期する
cd / mkdir /new_var mount -t xfs /dev/vdb1 /new_var rsync -avzr /var/ /new_var/
・元の /var を別名保存し、/var へ vdb をマウント
umount /new_var mv var var_old mkdir var mount -t xfs /dev/vdb1 /var
・fstab に追記
vi /etc/fstab ================================= /dev/vdb1 /var xfs defaults 0 2
・マルチユーザモードへ
init 3