我有一台 CentOS 服务器,有两个 1 TB 磁盘。但是,它的分区很糟糕。请检查以下内容:
[root@p16282558 ~]# fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xd4f28eb2
Device Boot Start End Blocks Id System
/dev/sdb1 1 523 4194304 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 523 784 2097152 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sdb3 784 121602 970470104 fd Linux raid autodetect
Partition 3 does not end on cylinder boundary.
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x724abfe3
Device Boot Start End Blocks Id System
/dev/sda1 1 523 4194304 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2 523 784 2097152 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 784 121602 970470104 fd Linux raid autodetect
Partition 3 does not end on cylinder boundary.
Disk /dev/md3: 993.8 GB, 993761296384 bytes
2 heads, 4 sectors/track, 242617504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md1: 4294 MB, 4294901760 bytes
2 heads, 4 sectors/track, 1048560 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg00-usr: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg00-var: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
当我运行 DF 命令时:
[root@p16282558 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md1 4.0G 4.0G 0 100% /
/dev/mapper/vg00-usr 4.0G 1.5G 2.4G 38% /usr
/dev/mapper/vg00-var 4.0G 880M 2.9G 23% /var
/dev/mapper/vg00-home
4.0G 136M 3.7G 4% /home
none 7.9G 556K 7.9G 1% /tmp
/opt 在 / 内,并且 / 中没有剩余空格
当我运行时,/etc/fstab
/dev/md1 / ext3 defaults 1 1
/dev/sda2 none swap sw
/dev/sdb2 none swap sw
/dev/vg00/usr /usr ext4 defaults 0 2
/dev/vg00/var /var ext4 defaults,usrquota 0 2
/dev/vg00/home /home ext4 defaults,usrquota 0 2
devpts /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
那么,是否存在已满的 md1 磁盘,以及一个未使用的磁盘 /dev/md3,其中有 993.8 GB 可用空间??
但,
[root@p16282558 ~]# df -h /dev/md3
Filesystem Size Used Avail Use% Mounted on
- 7.9G 204K 7.9G 1% /dev
PVS 和 LVS 的结果。
[root@p16282558 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md3 vg00 lvm2 a-- 925.51g 913.51g
[root@p16282558 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
home vg00 -wi-ao--- 4.00g
usr vg00 -wi-ao--- 4.00g
var vg00 -wi-ao--- 4.00g
这是否意味着 /dev 没有在系统启动时被挂载(根据 fstab)?
我的问题是:/opt 和 /var 应该安装在具有更多空间的磁盘/分区中。我该如何重组磁盘以有效利用所有磁盘空间?
请帮忙。
谢谢,Sash
答案1
看来您正在 /dev/md3 上使用 LVM,并且您只分配了 1TB 可用空间中的 12GB。
如果 /opt 占用了大部分容量,则可以创建一个新的逻辑卷并将其命名为 vg00-opt。创建后,可以将其临时挂载到 /mnt/whatever 上,并将文件从 /opt 移到新的逻辑卷中。最后,可以将 vg00-opt 挂载到 /opt 上。
您输入的命令df -h /dev/md3
仅告诉您 /dev 文件系统上已使用和可用的空间量。/tmp 和 /dev 都使用 tmpfs,它将使用 RAM 和/或交换来存储文件。这些目录在启动时将为空,但 /dev 中的条目由启动时启动的守护进程自动生成。默认情况下,tmpfs 的容量是 RAM 的一半,因此这两个的大小为 8GB,因为您有 16GB 的 RAM。