系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux創(chuàng)建使用LVM

Linux如何創(chuàng)建使用LVM(3)

時(shí)間:2015-02-12 17:35:12 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20150212/38335.html 手機(jī)查看 評(píng)論

  當(dāng)擴(kuò)展完物理邊界后你會(huì)發(fā)現(xiàn),掛載中的邏輯卷還是本身的大小。

  [root@station106 ~]# df -hT

  Filesystem Type Size Used Avail Use% Mounted on

  /dev/mapper/vg0-root

  ext4 20G 387M 19G 3% /

  tmpfs tmpfs 242M 0 242M 0% /dev/shm

  /dev/sda1 ext4 194M 29M 156M 16% /boot

  /dev/mapper/vg0-usr

  ext4 9.9G 1.9G 7.6G 20% /usr

  /dev/mapper/vg0-var

  ext4 20G 288M 19G 2% /var

  /dev/mapper/myvg-test

  ext4 9.9G 151M 9.2G 2% /mnt

  擴(kuò)展邏輯邊界,邏輯邊界指的是掛載后,在使用中的邏輯卷也直接識(shí)別了。

 。踨oot@station106 ~]# resize2fs /dev/myvg/test

  resize2fs 1.41.12 (17-May-2010)

  Filesystem at /dev/myvg/test is mounted on /mnt; on-line resizing required

  old desc_blocks = 1, new_desc_blocks = 1

  Performing an on-line resize of /dev/myvg/test to 3932160 (4k) blocks.

  The filesystem on /dev/myvg/test is now 3932160 blocks long.

 。踨oot@station106 ~]# df -hT

  Filesystem Type Size Used Avail Use% Mounted on

  /dev/mapper/vg0-root

  ext4 20G 387M 19G 3% /

  tmpfs tmpfs 242M 0 242M 0% /dev/shm

  /dev/sda1 ext4 194M 29M 156M 16% /boot

  /dev/mapper/vg0-usr

  ext4 9.9G 1.9G 7.6G 20% /usr

  /dev/mapper/vg0-var

  ext4 20G 288M 19G 2% /var

  /dev/mapper/myvg-test

  ext4 15G 153M 14G 2% /mnt

  上述就是擴(kuò)展邏輯卷部分。

  實(shí)例演示:縮小邏輯卷。首先為了測(cè)試我去原先掛載的錄下創(chuàng)建一些文件,測(cè)試一下縮小后會(huì)不會(huì)導(dǎo)致文件消失。

  縮小邏輯卷的步驟如下:

  1)先卸載之前的掛載,并執(zhí)行強(qiáng)制檢測(cè)。

 。踨oot@station106 ~]# umount /mnt/

 。踨oot@station106 ~]# e2fsck -f /dev/myvg/test

  e2fsck 1.41.12 (17-May-2010)

  Pass 1: Checking inodes, blocks, and sizes

  Pass 2: Checking directory structure

  Pass 3: Checking directory connectivity

  Pass 4: Checking reference counts

  Pass 5: Checking group summary information

  /dev/myvg/test: 13/983040 files (0.0% non-contiguous), 100864/3932160 blocks

  2)縮減邏輯邊界。

 。踨oot@station106 ~]# resize2fs /dev/myvg/test 10G

  resize2fs 1.41.12 (17-May-2010)

  Resizing the filesystem on /dev/myvg/test to 2621440 (4k) blocks.

  The filesystem on /dev/myvg/test is now 2621440 blocks long.

  3)縮減物理邊界。

  [root@station106 ~]# lvreduce -L 10G /dev/myvg/test

  WARNING: Reducing active logical volume to 10.00 GiB

  THIS MAY DESTROY YOUR DATA (filesystem etc.)

  Do you really want to reduce test? [y/n]: y

  Reducing logical volume test to 10.00 GiB

  Logical volume test successfully resized

  縮減后查看:

 。踨oot@station106 ~]# lvdisplay /dev/myvg/test

  --- Logical volume ---

  LV Path /dev/myvg/test

  LV Name test

  VG Name myvg

  LV UUID wY1YUF-f0o6-jzu1-mtTL-64p0-qvfC-3QfF8y

  LV Write Access read/write

  LV Creation host, time station106.magelinux.com, 2014-02-10 11:18:43 +0800

  LV Status available

  # open 0

  LV Size 10.00 GiB-》這里又變成了10G。

  Current LE 2560

  Segments 1

  Allocation inherit

  Read ahead sectors auto

  - currently set to 256

  Block device 253:4

  掛載繼續(xù)使用并且查看文件是否存在。

 。踨oot@station106 ~]# mount /dev/myvg/test /mnt/

 。踨oot@station106 ~]# cd /mnt/

 。踨oot@station106 mnt]# ls

  accp benet lost+found--》查看還是存在。未丟失。

 。踨oot@station106 mnt]# df -hT

  Filesystem Type Size Used Avail Use% Mounted on

  /dev/mapper/vg0-root

  ext4 20G 387M 19G 3% /

  tmpfs tmpfs 242M 0 242M 0% /dev/shm

  /dev/sda1 ext4 194M 29M 156M 16% /boot

  /dev/mapper/vg0-usr

  ext4 9.9G 1.9G 7.6G 20% /usr

  /dev/mapper/vg0-var

  ext4 20G 288M 19G 2% /var

  /dev/mapper/myvg-test

  ext4 9.9G 151M 9.2G 2% /mnt

標(biāo)簽 LVM

發(fā)表評(píng)論

0

沒有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄