1. 程式人生 > >Linux 下擴充根分割槽分割槽的大小

Linux 下擴充根分割槽分割槽的大小

 系統環境:RedHat 5.5 64bit

系統情況:採用作業系統預設分割槽(LV)

事件原由:擴充根分割槽大小

操作記錄:

[[email protected] ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-6527, default 6527):
Using default value 6527

Command (m for help): p

Disk /dev/sdb: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        6527    52428096   83  Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        6527    52428096   8e  Linux LVM

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] ~]#
[[email protected] ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[[email protected] ~]# partprobe
[[email protected] ~]# vgdisplay
  /dev/hdc: open failed: No medium found
  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               29.88 GB
  PE Size               32.00 MB
  Total PE              956
  Alloc PE / Size       956 / 29.88 GB
  Free  PE / Size       0 / 0  
  VG UUID               0W89dj-GEjI-ltiZ-k4Cp-LEYh-FUdc-5fTyde
  
[[email protected] ~]# vgextend VolGroup00 /dev/sdb1
  /dev/hdc: open failed: No medium found
  Volume group "VolGroup00" successfully extended
[[email protected] ~]# vgdisplay
  /dev/hdc: open failed: No medium found
  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               79.84 GB
  PE Size               32.00 MB
  Total PE              2555
  Alloc PE / Size       956 / 29.88 GB
  Free  PE / Size       1599 / 49.97 GB
  VG UUID               0W89dj-GEjI-ltiZ-k4Cp-LEYh-FUdc-5fTyde
  
[[email protected] ~]# lvdisplay
  /dev/hdc: open failed: No medium found
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                t58TE3-DbHI-QUUs-Tlle-9gSK-gn9U-YZAJFL
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                20.12 GB
  Current LE             644
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                4C8Tp1-rlhc-0P1E-oCEj-2V1b-Okan-weS2fm
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                9.75 GB
  Current LE             312
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
  
[[email protected] ~]# lvresize -l +1599 /dev/VolGroup00/LogVol00
  /dev/hdc: open failed: No medium found
  Extending logical volume LogVol00 to 70.09 GB
  Logical volume LogVol00 successfully resized
[[email protected] ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 18374656 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 18374656 blocks long.

[[email protected] ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       68G   14G   51G  22% /
/dev/sda1              99M   16M   78M  17% /boot
tmpfs                 3.9G  176M  3.8G   5% /dev/shm
[[email protected] ~]#

相關推薦

Linux 擴充分割槽分割槽大小

 系統環境:RedHat 5.5 64bit 系統情況:採用作業系統預設分割槽(LV) 事件原由:擴充根分割槽大小 操作記錄: [[email protected] ~]# fdisk /dev/sdb Device contains neither a val

linux磁碟檢視和分割槽

9月25日任務 4.1 df命令 4.2 du命令 4.3/4.4 磁碟分割槽 df命令 df輸出磁碟檔案系統使用情況: [root@centos ~]# df 檔案系統 1K-塊 已用 可用 已用% 掛載點 /

Linux 掛載Windows 磁碟分割槽及/etc/fstab 檔案詳解!

在電腦上安裝了雙系統,Linux有時候需要用到Windows的資源,所以選希望在Linux啟動時自動掛載windows分割槽。方法比較簡單,就是修改/etc/fstab檔案! 首先介紹一下/etc/fstab檔案格式。 /etc/fstab檔案配置了所有檔案系統和磁碟裝置的

linux3TB硬碟的分割槽問題

MBR分割槽表:主引導記錄,最大卷:2T,最多3主分割槽1擴充套件或是4主 GPT分割槽表:最大卷:18EB(E:Exabytes,1EB=1024TB),最多支援128個分割槽 linux下fdisk無法支援GPT,所以需要使用parted建立超過2T的分割槽: par

linux增加swap分區大小

linux swap官方建議RAM在2到4GB時,swap是RAM2倍;當RAM大於4GB時則swap等於RAM即可1、查看當前swap大小free -g2、設置swap大小dd if=/dev/zero of=/tmp/swap bs=1GB count=83、設置swap文件mkswap /tmp/

Linux 統計文件夾大小及文件數量

find wc 【查看文件夾大小】# /lib 目錄大小 du -sh /lib # /lib 子目錄大小 du -sh /lib/* # 查看 /lib 目錄下普通文件大小 find /lib -type f | xargs ls -la | awk -F ‘ ‘ ‘BEGIN{sum=0}

Linux自動清理超過指定大小檔案

  掃描某個目錄下的檔案,發現超過指定大小即清空 1)掃描目錄下的檔案 2)判斷檔案大小 3)清空大於指定檔案的內容   以byte為單位顯示檔案大小,然後和20M大小做對比. 20M換算成位元組為20971520這裡判斷是否大於20M,大於則使用echo 語句將對應檔案置空   20M=20 *

linuxLinux檢視CPU型號,記憶體大小,硬碟空間的命令(詳解)

1 檢視CPU 1.1 檢視CPU個數 # cat /proc/cpuinfo | grep "physical id" | uniq | wc -l 2 **uniq命令:刪除重複行;wc –l命令:統計行數** 1.2 檢視CPU核數 # cat /proc/c

linux更改tomcat啟動記憶體大小

近期要把測試的4個服務遷移到某臺測試機器上,可是這臺機器的記憶體空間只剩下4g了, 每個服務要是分配1g的記憶體,這個機器在流程高峰,記憶體不夠用,可能就會kill掉某個服務了,這樣會影響服務的穩定性,如果把對應服務的記憶體分配減少到512那麼就應該很足夠了。

Linux調整根目錄的空間大小

一、目的 在使用Linux系統的時候,發現根目錄(/)的空間不是很充足,而其他目錄空間有很大的空閒,所以本文主要是針對現在已有的空間進行調整。首先,先來檢視一下系統的空間分配情況: [plain] view plain copy  print? [[em

Linux檢視CPU型號,記憶體大小,硬碟空間的命令(詳解)

感謝有奉獻精神的人 轉自:http://www.jb51.net/article/97157.htm 1 檢視CPU 1.1 檢視CPU個數 # cat /proc/cpuinfo | grep "physical id" | un

linuxC獲取檔案的大小

stat(取得檔案狀態)    相關函式     fstat,lstat,chmod,chown,readlink,utime 表頭檔案     #include <sys/stat.h>#include <unistd.h> 定義函式     int   stat(const   c

Linux對lvm邏輯卷分割槽大小的調整(針對xfs和ext4不同檔案系統)

當我們在安裝系統的時候,由於沒有合理分配分割槽空間,在後續維護過程中,發現有些分割槽空間不夠使用,而有的分割槽空間卻有很多剩餘空間。如果這些分割槽在裝系統的時候使用了lvm(前提是這些分割槽要是lvm邏輯卷分割槽),那麼就可以輕鬆進行擴容或縮容!不同檔案系統型別所對應的建立、檢查、調整命令不同,下面就針對xf

Linux調整ext3分割槽大小【轉】

本文轉載自:https://blog.csdn.net/cruise_h/article/details/22403529 本文討論如何再不丟失資料的情況下調整已有ext3分割槽的大小,包括: 壓縮已有分割槽 增大已有分割槽 合併兩個ext3分割槽 這在沒有使用LVM(邏輯卷管理),而

linux修改swap分割槽大小

當前遇到的問題 修改linux下的swap分割槽尺寸 解決方法 Linux作業系統安裝以後,swap分割槽太小,兩種解決方法:增加swap分割槽、重新建立swap分割槽;首先要有root許可權,其次在操作過程中一定要很小心,一不小心可能就破壞了整個硬碟的資料,一定要三思而行

linux設定交換分割槽大小

出現 g++:internal commpiler error: Killed(program cc1plus) 錯誤一般是編譯c++時候記憶體太小,這時候我們需要擴大交換分割槽的大小。 設定交換空間大小 關閉交換空間檔案 sudo swa

Linux調整ext3分割槽大小

接下來刪除分割槽(資料並不會丟失),並建立較大的新分割槽(包含要擴充套件的部分)shell>fdisk /dev/sdaThe number of cylinders for this disk is set to 1305.There is nothing wrong with that, but t

虛擬機器分割槽擴充空間

今天上午接到通知說伺服器掛了,經過檢查發現原因是Linux的虛擬機器根分割槽已經使用100%,以至於服務不能正常進行。 經過小小的研究,順利解決問題,把伺服器的空間由4G擴成12G。現將執行全過程總結如下,以供分享。 首先,介紹下大體的解決思路,要想擴充,硬體上要有準備,說

linux基礎3-磁碟和檔案系統相關 LINUX支援哪些檔案系統 linux磁碟分割槽詳解 圖文(fdisk;mkfs)

一 dumpe2fs :    在Linux使用過程中,我們如果要了解檔案系統的配置情況,可以使用dumpe2fs檢視ext2/ext3/ext4格式的檔案系統資訊。 命令格式: dumpe2fs [選項] 裝置 常用選項: -h  僅列出超級塊中的資訊

Linuxfdisk命令操作磁碟詳解--新增、刪除、轉換分割槽

linux下fdisk命令操作磁碟詳解--新增、刪除、轉換分割槽等 fdisk 操作硬碟的命令格式如下: [[email protected] beinan]# fdisk 裝置 比如我們通過 fdisk -l 得知 /dev/hda 或者 /dev/sda 裝置;我們如果想再