欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

centos下如何使用fdisk擴(kuò)展分區(qū)容量大小

  發(fā)布時間:2016-12-05 14:24:31   作者:佚名   我要評論
下面小編為大家分享一篇centos下使用fdisk擴(kuò)展分區(qū)容量大??;感興趣的朋友可以過來看看

擴(kuò)展磁盤空間

硬盤空間為20G,使用vSphere Client增加磁盤大小,需要再增加10G空間;

fdisk_l-20G

vshere_add

擴(kuò)展完后,重啟系統(tǒng),再次使用fdisk -l查看,會發(fā)現(xiàn)硬盤空間變大了;

[root@linuxprobe ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005210c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1497     1572864   82  Linux swap / Solaris
/dev/sda4            1497        2611     8952832   83  Linux
[root@linuxprobe ~]# df -hT
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda2      ext4   9.7G  1.5G  7.7G  16% /
tmpfs          tmpfs  939M     0  939M   0% /dev/shm
/dev/sda1      ext4   194M   34M  151M  19% /boot
/dev/sda4      ext4   8.5G  148M  7.9G   2% /data

fdisk_l-30

重新創(chuàng)建分區(qū),調(diào)整分區(qū)信息

本次實(shí)驗(yàn)主要對/dev/sda4這個分區(qū)擴(kuò)展,如果是生產(chǎn)環(huán)境,請?zhí)崆白龊脗浞荼4娴狡渌謪^(qū),雖然擴(kuò)展分區(qū)大小不會導(dǎo)致數(shù)據(jù)丟失,安全起見,請?zhí)崆白龊脗浞荩?/p>

首先模擬出一些數(shù)據(jù):

[root@linuxprobe data]# mkdir test
[root@linuxprobe data]# echo "we are Linuxer" > linuxprobe
[root@linuxprobe data]# ll
total 24
-rw-r--r--. 1 root root    15 May 23 21:59 linuxprobe
drwx------. 2 root root 16384 May 23 15:07 lost+found
drwxr-xr-x. 2 root root  4096 May 23 21:51 test
[root@linuxprobe ~]# umount /dev/sda4          #卸載磁盤分區(qū)

若提示磁盤忙,使用fuser找出將正在使用磁盤的程序并結(jié)束掉;

fuser -m -v /data
fuser -m -v -i -k /data

使用fdisk工具先刪除/dev/sda4分區(qū),然后創(chuàng)建新分區(qū),注意開始的磁柱號要和原來的一致(是保證數(shù)據(jù)不丟失的關(guān)鍵步驟),結(jié)束的磁柱號默認(rèn)回車使用全部磁盤。

[root@linuxprobe ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p        #查看分區(qū)表信息Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005210c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1497     1572864   82  Linux swap / Solaris
/dev/sda4            1497        2611     8952832   83  Linux

Command (m for help): d           #刪除分區(qū)Partition number (1-4): 4         #刪除第四個Command (m for help): p       #再次查看分區(qū)信息,/dev/sda4已被刪除Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005210c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1497     1572864   82  Linux swap / Solaris

Command (m for help): n      #創(chuàng)建新的分區(qū)Command action
   e   extended
   p   primary partition (1-4)
p             #創(chuàng)建為主分區(qū)
Selected partition 4
First cylinder (1497-3916, default 1497):          #經(jīng)對比,正好和上一個磁盤柱一致,默認(rèn)即可Using default value 1497
Last cylinder, +cylinders or +size{K,M,G} (1497-3916, default 3916): 
Using default value 3916              #直接默認(rèn)就可以Command (m for help): p               #查看分區(qū)表信息Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005210c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        1497     1572864   82  Linux swap / Solaris
/dev/sda4            1497        3916    19436582   83  Linux

Command (m for help): wp       #保存并退出,如果創(chuàng)建有誤,直接退出不要保存即可The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

重新創(chuàng)建分區(qū)后,需要重啟一下;

[root@linuxprobe ~]# init 6
[root@linuxprobe ~]# e2fsck -f /dev/sda4                #檢查分區(qū)信息[root@linuxprobe ~]# resize2fs -p /dev/sda4             #調(diào)整分區(qū)大小

重新掛載、查看分區(qū)大小、數(shù)據(jù)

[root@linuxprobe ~]# mount /dev/sda4 /data
[root@linuxprobe ~]# df -hT
[root@linuxprobe ~]# cat /data/linuxprobe
we are  Linuxer

df-hT_19G

相關(guān)文章

  • CentOS服務(wù)器ntpdate同步的方法

    很多朋友都不知道CentOS服務(wù)器ntpdate同步的方法;下面小編就為大家分享CentOS服務(wù)器ntpdate同步的方法;有需要的朋友去看看吧
    2016-12-05
  • CentOS如何手動增加 刪除swap區(qū)

    很多朋友還不知道CentOS如何手動增加 刪除swap區(qū);下面小編就為大家分享一下CentOS手動增加 刪除swap區(qū)的方法,一起去看看吧
    2016-12-05
  • 2T以上硬盤如何安裝centos6

    本文將為大家具體的介紹2T以上硬盤如何安裝centos6的方法,幫你輕松解決大容量硬盤一樣可以安裝centos6,希望可以幫助到大家
    2016-12-04
  • CentOS7如何設(shè)置網(wǎng)絡(luò)自動啟動?

    安裝完成Centos7之后,配置了IP地址,如果重啟電腦,發(fā)現(xiàn)網(wǎng)絡(luò)服務(wù)并沒有啟動起來,那么,如何讓Centos7網(wǎng)絡(luò)自動啟動呢?下面小編就為大家?guī)鞢entOS7設(shè)置網(wǎng)絡(luò)自動啟動的方
    2016-12-01
  • CentOS7 如何設(shè)置截圖的快捷鍵?

    設(shè)置截屏快捷鍵:當(dāng)你剛安裝了centos7.0的時候,你對這個系統(tǒng)并不是很熟悉,當(dāng)你想用到一款截圖工具時,卻不知道怎么辦,其實(shí)系統(tǒng)自帶了截圖工具的,下面小編就為大家?guī)鞢
    2016-12-01
  • 詳解centos7安裝rabbitMq教程

    本文小編為大家具體的介紹centos7安裝rabbitMq的方法,rabbitmq是一個使用專業(yè)的消息隊(duì)列產(chǎn)品,需要注意的是在安裝rabbitt之前,要安裝erlang開發(fā)環(huán)境
    2016-12-01
  • CentOS6.6單用戶模式重設(shè)root密碼的方法

    一些朋友還不知道CentOS6.6單用戶模式如何重設(shè)root密碼;下面小編就為大家?guī)鞢entOS6.6單用戶模式重設(shè)root密碼的方法;有需要的朋友可以過來看看
    2016-11-30
  • centos6.5添加新網(wǎng)卡配置方法

    本文為大家詳細(xì)的介紹centos6.5如何添加新網(wǎng)卡配置,一起來看看吧
    2016-11-30
  • CentOS7如何設(shè)置交換文件?CentOS7設(shè)置交換文件的方法

    很多朋友都不知道CentOS7如何設(shè)置交換文件;下面小編就為大家?guī)鞢entOS7設(shè)置交換文件的方法;有需要的朋友可以過來看看
    2016-11-29
  • CentOS7擴(kuò)展根目錄空間操作步驟

    一些朋友還不知道如何在CentOS7下擴(kuò)展根目錄空間;下面小編就為大家?guī)鞢entOS7擴(kuò)展根目錄空間操作步驟;有需要的朋友可以過來看看
    2016-11-29

最新評論