设为首页 收藏本站
查看: 891|回复: 0

[经验分享] RedHat Enterprise Linux 7.0之XFS管理

[复制链接]

尚未签到

发表于 2014-7-4 15:56:43 | 显示全部楼层 |阅读模式
默认在rhel7中的文件系统格式是xfs,当然也可以创建ext3或者ext4,这里演示下xfs文件系统的简单管理。1.创建逻辑卷
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//创建PV
[iyunv@rhel7 ~]# pvcreate /dev/sd{b,c,d}
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
  Physical volume "/dev/sdd" successfully created
[iyunv@rhel7 ~]# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sda2  rootvg lvm2 a--  18.56g  4.00m
  /dev/sdb          lvm2 a--  20.00g 20.00g
  /dev/sdc          lvm2 a--  20.00g 20.00g
  /dev/sdd          lvm2 a--  20.00g 20.00g
//创建VG
[iyunv@rhel7-xzxj-edu-cn ~]# vgcreate testvg /dev/sdb
  Volume group "testvg" successfully created
[iyunv@rhel7-xzxj-edu-cn ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   1   2   0 wz--n- 18.56g  4.00m
  testvg   1   0   0 wz--n- 20.00g 20.00g
//创建LV
[iyunv@rhel7-xzxj-edu-cn ~]# lvcreate -n lv11 -L +5G testvg
  Logical volume "lv11" created
[iyunv@rhel7-xzxj-edu-cn ~]# lvcreate -n lv12 -L +5G testvg
  Logical volume "lv12" created



2.创建xfs文件系统
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[iyunv@rhel7-xzxj-edu-cn ~]# mkfs.xfs /dev/testvg/lv11
meta-data=/dev/testvg/lv11       isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[iyunv@rhel7-xzxj-edu-cn ~]# mkfs.xfs /dev/testvg/lv12
meta-data=/dev/testvg/lv12       isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0



3.挂在xfs文件系统
1
2
3
4
5
6
7
8
9
10
[iyunv@rhel7-xzxj-edu-cn ~]# mount /dev/testvg/lv11 /u01
[iyunv@rhel7-xzxj-edu-cn ~]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/rootvg-lv01   15G  3.8G   11G   26% /
devtmpfs                 927M     0  927M    0% /dev
tmpfs                    934M   80K  934M    1% /dev/shm
tmpfs                    934M  2.6M  931M    1% /run
tmpfs                    934M     0  934M    0% /sys/fs/cgroup
/dev/sda1                484M  106M  379M   22% /boot
/dev/mapper/testvg-lv11  5.0G   33M  5.0G    1% /u01



4.扩大xfs文件系统
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[iyunv@rhel7 ~]# lvextend -L +1G /dev/testvg/lv11
  Extending logical volume lv11 to 6.00 GiB
  Logical volume lv11 successfully resized
[iyunv@rhel7 ~]# xfs_growfs /u01/
meta-data=/dev/mapper/testvg-lv11 isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1310720 to 1572864
[iyunv@rhel7 ~]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/rootvg-lv01   15G  3.8G   11G   26% /
devtmpfs                 927M     0  927M    0% /dev
tmpfs                    934M   92K  934M    1% /dev/shm
tmpfs                    934M  2.8M  931M    1% /run
tmpfs                    934M     0  934M    0% /sys/fs/cgroup
/dev/sda1                484M  106M  379M   22% /boot
/dev/mapper/testvg-lv11  6.0G   33M  6.0G    1% /u01



5.备份xfs文件系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[iyunv@rhel7 ~]# xfsdump -l 0 -f /u02/u01.dmp /dev/testvg/lv11
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.3 (dump format 3.0) - type ^C for status and control
============================= dump label dialog ==============================
please enter label for this dump session (timeout in 300 sec)
-> Full_bkp
session label entered: "Full_bkp"
--------------------------------- end dialog ---------------------------------
xfsdump: level 0 dump of rhel7-xzxj-edu-cn:/u01
xfsdump: dump date: Fri Jan  3 22:21:05 2014
xfsdump: session id: a389be53-fc2c-4a22-92d0-cd0c1fdbb06e
xfsdump: session label: "Full_bkp"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 196928 bytes
xfsdump: /var/lib/xfsdump/inventory created
============================= media label dialog =============================
please enter label for media in drive 0 (timeout in 300 sec)
-> Test
media label entered: "Test"
--------------------------------- end dialog ---------------------------------
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 182304 bytes
xfsdump: dump size (non-dir files) : 145888 bytes
xfsdump: dump complete: 15 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /u02/u01.dmp OK (success)
xfsdump: Dump Status: SUCCESS



6.恢复xfs文件系统备份
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[iyunv@rhel7-xzxj-edu-cn ~]# cd /u01/
[iyunv@rhel7-xzxj-edu-cn u01]# ls
asound.conf            e2fsck.conf   krb5.conf       man_db.conf    oddjobd.conf      resolv.conf     sysctl.conf
autofs_ldap_auth.conf  fprintd.conf  ksmtuned.conf   mke2fs.conf    opensc.conf       rsyncd.conf     updatedb.conf
brltty.conf            fuse.conf     ld.so.conf      mtools.conf    pbm2ppa.conf      rsyslog.conf    usb_modeswitch.conf
chrony.conf            hba.conf      libaudit.conf   nfsmount.conf  pnm2ppa.conf      sestatus.conf   vconsole.conf
colord.conf            host.conf     libuser.conf    nsswitch.conf  prelink.conf      sos.conf        wvdial.conf
dnsmasq.conf           idmapd.conf   locale.conf     ntp.conf       radvd.conf        sudo.conf       yum.conf
dracut.conf            kdump.conf    logrotate.conf  numad.conf     request-key.conf  sudo-ldap.conf
[iyunv@rhel7-xzxj-edu-cn u01]# rm -rf *
[iyunv@rhel7-xzxj-edu-cn u01]# ls
[iyunv@rhel7-xzxj-edu-cn u01]#
[iyunv@rhel7-xzxj-edu-cn ~]# xfsrestore -f /u02/u01.dmp /u01
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.3 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description:
xfsrestore: hostname: rhel7-xzxj-edu-cn
xfsrestore: mount point: /u01
xfsrestore: volume: /dev/mapper/testvg-lv11
xfsrestore: session time: Fri Jan  3 22:21:05 2014
xfsrestore: level: 0
xfsrestore: session label: "Full_bkp"
xfsrestore: media label: "Test"
xfsrestore: file system id: cc858c9e-d5fb-4812-b99a-38f2779e047f
xfsrestore: session id: a389be53-fc2c-4a22-92d0-cd0c1fdbb06e
xfsrestore: media id: b62663cd-386c-485c-bb76-5acdbe98fc81
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 48 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /u02/u01.dmp OK (success)
xfsrestore: Restore Status: SUCCESS
[iyunv@rhel7-xzxj-edu-cn ~]# ls /u01
asound.conf            e2fsck.conf   krb5.conf       man_db.conf    oddjobd.conf      resolv.conf     sysctl.conf
autofs_ldap_auth.conf  fprintd.conf  ksmtuned.conf   mke2fs.conf    opensc.conf       rsyncd.conf     updatedb.conf
brltty.conf            fuse.conf     ld.so.conf      mtools.conf    pbm2ppa.conf      rsyslog.conf    usb_modeswitch.conf
chrony.conf            hba.conf      libaudit.conf   nfsmount.conf  pnm2ppa.conf      sestatus.conf   vconsole.conf
colord.conf            host.conf     libuser.conf    nsswitch.conf  prelink.conf      sos.conf        wvdial.conf
dnsmasq.conf           idmapd.conf   locale.conf     ntp.conf       radvd.conf        sudo.conf       yum.conf
dracut.conf            kdump.conf    logrotate.conf  numad.conf     request-key.conf  sudo-ldap.conf



参考文献:

     1.Storage Administration Guide
     2.XFS User Guide


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-21641-1-1.html 上篇帖子: RedHat Enterprise Linux 7.0安装图解 下篇帖子: corosync+ pacemaker实现pg流复制自动切换(一) Linux
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表