目标:10T的碎文件(10k-500k)数据需要局域网从一台存储迁移到另一台存储
方案:采用基于drbd软件迁移扩容方案
提示:主节点10T,备节点20T,如果采用drbd同步方案,同步后备用节点和主节点一样大小。备节点的剩余10T看不到也无法使用。
问题:
主节点,备节点是2.0G,备节点是2.0G(实际应该是3G,通过df -h命令只能看到2G)
[root@nfs-server-01 teddylu]# df -h|grep md0
/dev/drbd0 2.0G 3.0M 1.9G 1% /md0
[root@nfs-server-02 teddylu]# df -h|grep md0
/dev/md0 2.0G 3.0M 1.9G 1% /md0
[root@nfs-server-02 teddylu]# fdisk -l|grep /dev/md0
Disk /dev/md0: 3205 MB, 3205496832 bytes
原因:
因为drbd是基于block的复制,所以备节点上的的size会和主节点一模一样。
解决:
[root@nfs-server-02 teddylu]# umount /md0/
[root@nfs-server-02 teddylu]# drbdadm down data
[root@nfs-server-02 teddylu]# e2fsck -f /dev/md0
e2fsck 1.41.12 (17-May-2010)
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/md0: 21/130560 files (0.0% non-contiguous), 17164/521472 blocks
[root@nfs-server-02 teddylu]# resize2fs /dev/md0
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/md0 to 782592 (4k) blocks.
The filesystem on /dev/md0 is now 782592 blocks long.
[root@nfs-server-02 teddylu]# mount /dev/md0 /md0/
[root@nfs-server-02 teddylu]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 7.8G 3.5G 3.9G 48% /
tmpfs 242M 0 242M 0% /dev/shm
/dev/sda1 190M 49M 132M 28% /boot
/dev/md0 3.0G 3.0M 2.8G 1% /md0
此时,备节点的size是显示为正常的3G了
提示
e2fsck – check a Linux ext2/ext3/ext4 file system
-f Force checking even if the file system seems clean.
resize2fs – ext2/ext3/ext4 file system resizer
The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device。