linux如何修改已挂载磁盘的ftype值?

linux如何修改已挂载磁盘的ftype值?,第1张

修改fstype值,建议备份该盘的数据到其它盘。然后分三步1.卸载文件系统 umount /路径2.对设备重做文件系统,指定新的文件系统类型 makefs -t 新文件系统类型 设备路径(如/dev/dsk01)3.最后指定文件系统类型挂载文件系统。mount -t 新文件系统类型 设备 目录

一、磁盘管理

步骤:

1. 物理磁盘被格式化为PV,空间被划分成一个个PE

2. 不同的PV加入同一个VG中,不同PV的PE全部进入VG的PE池;

3. 在VG中基于PE创建LV,组成LV的PE可能来自于不同的物理磁盘;

4. LV直接格式化后挂在使用;

5. LV的增加或减少其实就是增加或减少该组LV的PE数量,其过程不会丢失原始数据。

*** 作步骤:

①查看待分配的磁盘

[root@cen7 ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 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: 0x000a39f5

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048      452607      225280   83  Linux

/dev/sda2          452608   415227903   207387648   83  Linux

/dev/sda3       415227904   419422207     2097152   82  Linux swap / Solaris

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 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: 0x99bab3b4

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    10487807     5242880   8e  Linux LVM

②创建PV

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

WARNING: dos signature detected on /dev/sdb1 at offset 510. Wipe it? [y/n]: y

  Wiping dos signature on /dev/sdb1.

  Physical volume "/dev/sdb1" successfully created.

③查看PV

[root@cen7 ~]# pvdisplay /dev/sdb1

  "/dev/sdb1" is a new physical volume of "5.00 GiB"

  --- NEW Physical volume ---

  PV Name               /dev/sdb1

  VG Name

  PV Size               5.00 GiB

  Allocatable           NO

  PE Size               0

  Total PE              0

  Free PE               0

  Allocated PE          0

  PV UUID               yxWtAD-9Pye-9hVt-H7sZ-h44x-3MyP-NpadQ8

④创建VG

[root@cen7 ~]# vgcreate vg01 /dev/sdb1

  Volume group "vg01" successfully created

⑤查看VG

[root@cen7 ~]# vgdisplay

  --- Volume group ---

  VG Name               vg01

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               <5.00 GiB

  PE Size               4.00 MiB

  Total PE              1279

  Alloc PE / Size       0 / 0

  Free  PE / Size       1279 / <5.00 GiB

  VG UUID               fVnLdP-mVtf-e1HI-33pR-MOcS-PLs5-l6nDck

⑥创建LV

[root@cen7 ~]# lvcreate -n lv01 -L 4.996G vg01#空间大小=1279*4M/1024

  Rounding up size to full physical extent <5.00 GiB

  Logical volume "lv01" created.

或者

[root@cen7 ~]# lvcreate -n lv01 -l 1279 vg01

  Logical volume "lv01" created.

⑦查看LV

[root@cen7 ~]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/vg01/lv01

  LV Name                lv01

  VG Name                vg01

  LV UUID                dq0d77-sVP2-F3CX-baQC-5fvy-MeTU-YE710s

  LV Write Access        read/write

  LV Creation host, time cen7, 2022-02-22 10:12:04 +0800

  LV Status              available

  # open                 0

  LV Size                <5.00 GiB

  Current LE             1279

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           253:0

⑧格式化文件系统

[root@cen7 ~]# mkfs.xfs /dev/vg01/lv01

meta-data=/dev/vg01/lv01         isize=512    agcount=4, agsize=327424 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0, sparse=0

data     =                       bsize=4096   blocks=1309696, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   b

⑨挂载文件分区

[root@cen7 ~]# mkdir /mnt/lv01

[root@cen7 ~]# mount /dev/vg01/lv01 /mnt/lv01

⑩查看是否挂在成功

[root@cen7 ~]# df -Th

Filesystem            Type      Size  Used Avail Use% Mounted on

devtmpfs              devtmpfs  2.0G     0  2.0G   0% /dev

tmpfs                 tmpfs     2.0G     0  2.0G   0% /dev/shm

tmpfs                 tmpfs     2.0G   13M  2.0G   1% /run

tmpfs                 tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup

/dev/sda2             xfs       198G   27G  172G  14% /

/dev/sda1             xfs       217M  147M   71M  68% /boot

tmpfs                 tmpfs     394M  4.0K  394M   1% /run/user/42

tmpfs                 tmpfs     394M   28K  394M   1% /run/user/0

/dev/sr0              iso9660   4.4G  4.4G     0 100% /run/media/root/CentOS 7 x86_64

/dev/mapper/vg01-lv01  xfs       5.0G   33M  5.0G   1% /mnt/lv01

⑧移除LV

[root@cen7 ~]# lvremove /dev/vg01/lv01

Do you really want to remove active logical volume vg01/lv01? [y/n]: y

  Logical volume "lv01" successfully removed


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7264541.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存