linux下怎么创建分区

创建逻辑分区

[root@localhost ~]# fdisk -l /dev/sdb

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         200     1606468+  8e  Linux LVM

[root@localhost ~]# partx -a /dev/sdb          #告诉内核有关存在和磁盘上的分区的编号

[root@localhost ~]# pvcreate /dev/sdb1

-bash: pvcreate: command not found

[root@localhost ~]# yum -y install lvm2        #安装lvm

[root@localhost ~]# pvcreate /dev/sdb1         #创建物理卷

Physical volume "/dev/sdb1" successfully created

[root@localhost ~]# vgcreate myvg /dev/sdb1    #创建卷组myvg

Volume group "myvg" successfully created

[root@localhost ~]# lvcreate -n mydata -L 1G myvg   #创建一个1G的逻辑卷

Logical volume "mydata" created

[root@localhost ~]# mkfs.ext4 /dev/myvg/mydata    #格式化

[root@localhost ~]# vi /etc/fstab

/dev/myvg/mydata             /mydata          ext4  defaults         0 0    #增加一行

[root@localhost ~]# mount -a

[root@localhost ~]# mount

/dev/sda3 on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

/dev/sr0 on /mnt type iso9660 (ro)

/dev/mapper/myvg-mydata on /mydata type ext4 (rw)

你可能感兴趣的:(linux下怎么创建分区)