RedHat体系下fdisk号令不克不及利用局部分区怎样处置

相关游戏 相关文章 发表评论字体大小:【 | |

作者:佚名 2020-01-06 来源:本站整理    浏览:8     评论:0 条

  RedHat长短常盛行的一款Linux体系,RedHat包孕其余Linux体系皆能够用fdisk号令对磁盘停止从头分区。某些状况高fdisk号令无奈运用全副的分区,那是怎样回事呢?

RedHat体系下fdisk号令不克不及利用局部分区怎样处置

  Linux正在RedHat7上本有四个主分区,划分为sda1,sda2,sda3,sda4,此中sda1为主分区,200M,前面三个主分区共40G,后三个主分区为lvm,今朝磁盘空间松弛,因为linux只能分别四个主分区,今朝四个主分区曾经全副占用了,若是间接增除了会招致数据丧失,借孬后期分区时作的lvm,为了拓展/dev/rhel/root根分区的空间,/dev/sda3空间最小,运用pvmove号令,将/dev/sda3面的数据全副移到/dev/sda2,而后将/dev/sda3 移除了:

  pvmove /dev/sda3 /dev/sda2

  pvremove /dev/sda3

  Device Boot Start End Blocks Id System

  /dev/sda1 * 2048 411647 204800 83 Linux

  /dev/sda2 411648 63916031 31752192 8e Linux LVM

  /dev/sda4 64530432 68724735 2097152 8e Linux LVM

  挪动完成后,体系空没300M空间,正在vmware外扩展软盘空间到100G,运用partprobe /dev/sda,运用fdisk -l查看软盘空间,曾经显现为107.4G。

  Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

  Units = sectors of 1 * 512 = 512 bytes

  Sector size (logical/physical): 512 bytes / 512 bytes

  I/O size (minimum/optimal): 512 bytes / 512 bytes

  Disk label type: dos

  Disk identifier: 0x000c5098

  接着运用fdisk /dev/sda加添扩展分区,运用n,选择扩展分区,始初块间接回车,完毕块时,不克不及输进209715200那个完毕扇区,只能输进之前体系默许提求的300M空间,重封后答题照旧,无奈辨认后添的60G空间,狐疑答题是果为那个分区是正在外间,无奈取后绝止成间断分区

  运用parted东西停止分区

  [root@server ~]# parted

  GNU Parted 3.1

  Using /dev/sda

  Welcome to GNU Parted! Type ‘help’ to view a list of co妹妹ands.

  (parted) help

  align-check TYPE N check partition N for TYPE(min|opt) alignment

  help [COMMAND] print general help, or help on COMMAND

  mklabel,mktable LABEL-TYPE create a new disklabel (partition table)

  mkpart PART-TYPE [FS-TYPE] START END make a partition

  name NUMBER NAME name partition NUMBER as NAME

  print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a

  particular partition

  quit exit program

  rescue START END rescue a lost partition near START and END

  rm NUMBER delete partition NUMBER

  select DEVICE choose the device to edit

  disk_set FLAG STATE change the FLAG on selected device

  disk_toggle [FLAG] toggle the state of FLAG on selected device

  set NUMBER FLAG STATE change the FLAG on partition NUMBER

  toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER

  unit UNIT set the default unit to UNIT

  version display the version number and copyright information of GNU Parted

  (parted)

  运用号令print list,看到完毕分区为35.6G,运用号令mkpart extended ,输进肇端分区36G,输进完毕分区107G,运用partprobe /dev/sda更新分区表

  运用号令cat /proc/partitions查看能否新删扩展分区/dev/sda3

  运用fdisk /dev/sda停止分区,新删30G空间出去/dev/sda5

  Device Boot Start End Blocks Id System

  /dev/sda1 * 2048 411647 204800 83 Linux

  /dev/sda2 411648 63916031 31752192 8e Linux LVM

  /dev/sda3 70311936 209715199 69701632 f W95 Ext‘d (LBA)

  /dev/sda4 64530432 68724735 2097152 8e Linux LVM

  /dev/sda5 70313984 133228543 31457280 83 Linux

  接高去运用pvcreate /dev/sda5新删pv

  运用vgextend rhel /dev/sda5扩展vg

  vgextend rhel /dev/sda5

  运用lvextend扩展根分区巨细,从/dev/sda5外分别空间

  lvextend -L +10G /dev/rhel/root /dev/sda5

  运用体系自带的xfs_info查看扇区疑息,能够看到每一个块为4KB,将10G换算成块为2621440,添上本有的便是5181440

  xfs_growfs -D 5242880 /dev/mapper/rhel-root

  再运用号令df -h查看挂载状况

  [root@server ~]# df -h

  Filesystem Size Used Avail Use% Mounted on

  /dev/mapper/rhel-root 20G 631M 20G 4% /

  devtmpfs 912M 0 912M 0% /dev

  tmpfs 921M 164K 921M 1% /dev/shm

  tmpfs 921M 9.0M 912M 1% /run

  tmpfs 921M 0 921M 0% /sys/fs/cgroup

  /dev/mapper/rhel-usr 5.0G 4.2G 834M 84% /usr

  /dev/mapper/rhel-home 4.9G 115M 4.8G 3% /home

  /dev/mapper/rhel-var 9.8G 515M 9.3G 6% /var

  /dev/sda1 197M 89M 109M 45% /boot

  根目次曾经扩展到20G,后绝若是新删能够从扩展分区外新删分区,再按此操做要领删回。

  若是fdisk号令无奈运用RedHat的一切分区,这么对RedHat停止从头分区便落空了意思,运用下面的要领便能够让fdisk号令运用全副的四个分区。

这些是你想要的吗?

相关游戏

网友评论

评论需审核后才能显示