今天下午公司技術(shù)部門在開(kāi)會(huì),留下我一個(gè)人在值班,另一個(gè)客戶開(kāi)了個(gè)意大利vps,安裝的是linux系統(tǒng),但是沒(méi)有分區(qū),需要我分區(qū),小編我說(shuō)實(shí)話我也是剛來(lái)公司沒(méi)多久,對(duì)技術(shù)這方面確實(shí)還不是很熟練,更別說(shuō)Linux系統(tǒng)了,他們都再開(kāi)會(huì),安也不敢問(wèn)也不敢敲門,里面好像有同時(shí)挨批了,于是我就自己百度查找如何分區(qū),找了好長(zhǎng)時(shí)間,意大利vps也重裝了好幾遍,終于把分區(qū)成功了,下面就是我分區(qū)的所有流程,希望朋友能看懂,
login as: root
root@162.1.5.1's password:
Last failed login: Sat Aug 19 18:08:04 CST 2017 from 190.50.239.105 on ssh:notty
There were 6 failed login attempts since the last successful login.
Last login: Sat Aug 19 18:06:22 2017 from 1.1.1.152
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 8.5G 1.6G 7.0G 19% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 493M 0 493M 0% /dev/shm
tmpfs 493M 6.5M 487M 2% /run
tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/sda1 494M 124M 371M 25% /boot
tmpfs 99M 0 99M 0% /run/user/0
[root@localhost ~]# fdisk -l
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000f1903
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 20971519 9972736 8e Linux LVM
Disk /dev/mapper/centos-root: 9093 MB, 9093251072 bytes, 17760256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-swap: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
[root@localhost ~]# fdisk /dev/sdb
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 0xc35805b7.
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
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-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# mke2fs -jv /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
fs_types for mke2fs.conf resolution: 'ext3'
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621184 blocks
131059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# vgextend centos /dev/sdb1
WARNING: ext3 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
Wiping ext3 signature on /dev/sdb1.
Physical volume "/dev/sdb1" successfully created
Volume group "centos" successfully extended
[root@localhost ~]# lvextend -L+9.8G /dev/centos/root
Rounding size to boundary between physical extents: 9.80 GiB
Size of logical volume centos/root changed from 8.47 GiB (2168 extents) to 18.27 GiB (4677 extents).
Logical volume root successfully resized.
[root@localhost ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
open: No such file or directory while opening /dev/vg_cloud/lv_root
[root@localhost ~]# mount |grep root
/dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
[root@localhost ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=555008 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=2220032, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2220032 to 4789248
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 19G 1.6G 17G 9% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 493M 0 493M 0% /dev/shm
tmpfs 493M 6.5M 487M 2% /run
tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/sda1 494M 124M 371M 25% /boot
tmpfs 99M 0 99M 0% /run/user/0
[root@localhost ~]#