luozhangyou 发表于 2017-11-19 20:04:02

centos6.x分区扩容

红色为您要键入的指令,绿色为需要注意的内容,蓝色为说明
特别提醒:删除分区后一定要先建立分区再保存,删除后点了保存会导致数据丢失。该操作有风险,为避免误操作导致数据丢失,操作前请对您的重要数据进行备份!以下操作仅适用于centos6.x ,若是是使用的centos7.x 版本请使用fdisk工具完成,操作流程一致。

Centos:
#yum -y install gdisk      //安装分区工具#gdisk /dev/vda      //操作根分区磁盘Command (? for help): p    //查看分区Disk /dev/vda: 104857600 sectors, 50.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): B7172F0B-2C30-4535-981D-F0ED8B4A6065Partition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 104857566Partitions will be aligned on 2048-sector boundariesTotal free space is 41945021 sectors (20.0 GiB)
NumberStart (sector)    End (sector)Size       CodeName   1            2048      62914559   30.0 GiB    8300Linux filesystem    //注意这个值Command (? for help): d      //删除分区Using 1
Command (? for help): 1b       back up GPT data to a filec       change a partition's named       delete a partitioni       show detailed information on a partitionl       list known partition typesn       add a new partitiono       create a new empty GUID partition table (GPT)p       print the partition tableq       quit without saving changesr       recovery and transformation options (experts only)s       sort partitionst       change a partition's type codev       verify diskw       write table to disk and exitx       extra functionality (experts only)?       print this menu
Command (? for help): nPartition number (1-128, default 1): 1First sector (34-104857566, default = 2048) or {+-}size{KMGTP}: 2048   //刚才记录的Last sector (2048-104857566, default = 104857566) or {+-}size{KMGTP}:   //直接回车Current type is 'Linux filesystem'Hex code or GUID (L to show codes, Enter = 8300):            //直接回车Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!
Do you want to proceed? (Y/N): yOK; writing new GUID partition table (GPT) to /dev/vda.Warning: The kernel is still using the old partition table.The new table will be used at the next reboot.The operation has completed successfully.
#reboot                        //重启让分区生效#resize2fs -f /dev/vda1               //开始扩容根分区resize2fs -f /dev/vda1resize2fs 1.41.12 (17-May-2010)Filesystem at /dev/vda1 is mounted on /; on-line resizing requiredold desc_blocks = 2, new_desc_blocks = 4Performing an on-line resize of /dev/vda1 to 13106939 (4k) blocks.The filesystem on /dev/vda1 is now 13106939 blocks long.
#df -vh                            //完成,查看新的根分区大小
原文地址https://www.west.cn/faq/list.asp?unid=905


页: [1]
查看完整版本: centos6.x分区扩容