阿里云磁盘扩容记录
[root@demo ~]# service ngxin stop Redirecting to /bin/systemctl stop ngxin.service Failed to stop ngxin.service: Unit ngxin.service not loaded. [root@demo ~]# service nginx stop Stopping nginx (via systemctl): [ OK ] [root@demo ~]# umount /dev/vdb1 umount: /data: target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) [root@demo ~]# service mysqld stop Shutting down MySQL.. [ OK ] [root@demo ~]# umount /dev/vdb1 [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 [root@demo ~]# 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. Command (m for help): d Selected partition 1 Partition 1 is deleted Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Using default response p Partition number (1-4, default 1): First sector (2048-230686719, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-230686719, default 230686719): Using default value 230686719 Partition 1 of type Linux and of size 110 GiB is set Command (m for help): wq The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@demo ~]# e2fsck -f /dev/vdb1 e2fsck 1.42.9 (28-Dec-2013) /dev/vdb1 is mounted. e2fsck: Cannot continue, aborting. [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 /dev/vdb1 69G 59G 6.4G 91% /data [root@demo ~]# umount /dev/vdb1 [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 [root@demo ~]# e2fsck -f /dev/vdb1 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/vdb1: 84876/4587520 files (0.9% non-contiguous), 15768264/18349824 blocks [root@demo ~]# resize2fs /dev/vdb1 resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/vdb1 to 28835584 (4k) blocks. The filesystem on /dev/vdb1 is now 28835584 blocks long. [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 [root@demo ~]# mount /dev/vdb1 /resizetest mount: mount point /resizetest does not exist [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 [root@demo ~]# mount /dev/vdb1 [root@demo ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 500K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 8.3G 29G 23% / tmpfs 783M 0 783M 0% /run/user/0 /dev/vdb1 109G 59G 44G 58% /data [root@demo ~]# service nginx restart
lsblk 查看分区和磁盘 df -h 查看空间使用情况 fdisk -l 分区工具查看分区信息 cfdisk /dev/sda 查看分区 blkid 查看硬盘label(别名) du -sh ./* 统计当前目录各文件夹大小 free -h 查看内存大小 cat /proc/cpuinfo| grep "cpu cores"| uniq 查看cpu核心数 cat /proc/cpuinfo| grep "physical id"|uniq| wc -l 查看物理cpu个数 cat /proc/cpuinfo| grep "processor"| wc -l 查看逻辑cpu的个数