一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Linux|Centos|Ubuntu|系統(tǒng)進(jìn)程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務(wù)器之家 - 服務(wù)器系統(tǒng) - Centos - centos下如何使用fdisk擴(kuò)展分區(qū)容量大小

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

2019-07-04 16:07centos之家 Centos

下面小編為大家分享一篇centos下使用fdisk擴(kuò)展分區(qū)容量大小;感興趣的朋友可以過來看看

擴(kuò)展磁盤空間

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

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

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

擴(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

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

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

本次實驗主要對/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.

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

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

重新創(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

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

延伸 · 閱讀

精彩推薦
  • CentosCentos 7開啟網(wǎng)卡自動獲取IP的詳細(xì)方法

    Centos 7開啟網(wǎng)卡自動獲取IP的詳細(xì)方法

    本篇文章主要介紹了Centos 7開啟網(wǎng)卡自動獲取IP的詳細(xì)方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧...

    凌鋒8972021-12-29
  • CentosCentOS 6.6實現(xiàn)永久修改DNS地址的方法

    CentOS 6.6實現(xiàn)永久修改DNS地址的方法

    這篇文章主要介紹了CentOS 6.6實現(xiàn)永久修改DNS地址的方法,涉及針對CentOS配置文件的相關(guān)設(shè)置技巧,具有一定參考借鑒價值,需要的朋友可以參考下 ...

    Linux社區(qū)4472020-08-21
  • CentosCentOS6.5下Redis安裝與配置詳細(xì)步驟

    CentOS6.5下Redis安裝與配置詳細(xì)步驟

    本篇文章主要介紹了CentOS6.5下Redis安裝與配置詳細(xì)步驟,詳細(xì)介紹redis單機(jī)單實例安裝與配置,服務(wù)及開機(jī)自啟動。有興趣的可以了解一下。...

    飛流11452021-12-24
  • Centoscentos不小心刪除/root目錄該如何解決?

    centos不小心刪除/root目錄該如何解決?

    一些朋友最近在問小編centos不小心刪除/root目錄該如何解決?今天小編就為大家分享centos不小心刪除/root目錄解決辦法;希望對大家會有幫助,有需要的朋友...

    腳本之家8022019-05-29
  • CentosCentOS7設(shè)置日期和時間方法以及基本概念介紹

    CentOS7設(shè)置日期和時間方法以及基本概念介紹

    這篇文章主要介紹了CentOS7設(shè)置日期和時間方法以及基本概念介紹,本文講解使用CentOS7中的新命令timedatectl設(shè)置日期時間方法,需要的朋友可以參考下 ...

    CentOS之家6522019-09-19
  • CentosCentOS下Uptime命令詳解

    CentOS下Uptime命令詳解

    在Linux下,我們可以使用uptime命令,而且此命令不必使用root權(quán)限。uptime命令在系統(tǒng)中已經(jīng)默認(rèn)安裝了。今天小編為大家?guī)淼氖荂entOS下Uptime命令詳解;希望...

    CentOS之家11482019-06-19
  • Centoscentos 安裝與操作方法

    centos 安裝與操作方法

    這篇文章主要介紹了centos 安裝與操作方法,需要的朋友可以參考下...

    centos之家5272019-07-11
  • CentosCentos7運用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    Centos7運用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    這篇文章主要介紹了LINUX中Centos7運用/dev/shm進(jìn)行網(wǎng)站優(yōu)化相關(guān)知識點,對此有興趣的朋友參考學(xué)習(xí)下。...

    彬菌9912022-03-02
主站蜘蛛池模板: 成人国产午夜在线视频 | 手机国产乱子伦精品视频 | 大乳奶水bbw | 男人疯狂擦进女人下面 | 男女男精品网站 | 日韩高清一区二区三区不卡 | 潘甜甜在线观看 | 亚洲国产五月综合网 | 免费91麻豆精品国产自产在线观看 | 成人免费网站视频ww | 亚州春色 | 2020国语对白露脸 | 青青青久在线视频免费观看 | 99热这里有精品 | 日本一卡二卡3卡四卡网站精品 | 无人在线高清观看 | 天作谜案免费完整版在线观看 | 性xxxx中国| 99视频在线观看免费视频 | 亚洲免费色图 | 国产资源站| 秘书喂奶好爽一边 | 午夜伦伦电影理论片大片 | 日韩国产欧美视频 | 欧美色青| 国产一级片免费视频 | 久久久久久久国产精品视频 | 日本videosdesexo乱| 亚洲视频中文字幕 | 羲义嫁密着中出交尾gvg794 | 国产亚洲精品第一综合另类 | 特黄视频免费看 | 微福利92合集 | bbwfreehd女厕所ved| 亚洲国产99999在线精品一区 | 免费精品一区二区三区在线观看 | 白丝打脚枪 | 亚洲娇小videos | 国产免费看黄的私人影院 | 国自产精品手机在线视频 | 色综合欧美色综合七久久 |