原來(lái)一個(gè)分區(qū)分得太小了(只有5G),等拷貝完數(shù)據(jù)才知道太小了。于是嘗試了擴(kuò)容的辦法。以前對(duì)ext3干過(guò)這樣的事情,看了ext3上的wiki介紹,得知做法和原來(lái)的ext2/ext3一樣(看來(lái)兼容性還是不錯(cuò))。下面是我的擴(kuò)容過(guò)程
首先下載你要擴(kuò)容的分區(qū),這樣當(dāng)然是最保險(xiǎn)的,如果你就是不想卸載,只要你別對(duì)其做寫操作,也沒(méi)有問(wèn)題。
接下來(lái)就是用fdisk刪除該分區(qū),然后用你期望的大小重建該分區(qū)。這里要注意的是,分區(qū)的開始扇區(qū)一定要和刪除前保持一致,否則文件系統(tǒng)就會(huì)遭到破壞。下面是我的實(shí)際操作過(guò)程
- # fdisk /dev/sda
-
- Command (m for help): p
-
- Disk /dev/sda: 64.4 GB, 64424509440 bytes
- 255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00067b51
-
- Device Boot Start End Blocks Id System
- /dev/sda1 * 63 29302559 14651248+ 83 Linux
- /dev/sda2 29302784 39061503 4879360 83 Linux
-
- Command (m for help): d
- Partition number (1-4): 2
-
- Command (m for help): n
- Command action
- e extended
- p primary partition (1-4)
- p
- Partition number (1-4, default 2):
- Using default value 2
- First sector (29302560-125829119, default 29302560): 29302784
- Last sector, +sectors or +size{K,M,G} (29302784-125829119, default 125829119): +20G
-
- Command (m for help): p
-
- Disk /dev/sda: 64.4 GB, 64424509440 bytes
- 255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00067b51
-
- Device Boot Start End Blocks Id System
- /dev/sda1 * 63 29302559 14651248+ 83 Linux
- /dev/sda2 29302784 71245823 20971520 83 Linux
-
- Command (m for help): w
- 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.
而后執(zhí)行下面的指令
- # partprobe /dev/sda
- # e2fsck -f /dev/sda2
- 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
- data: 38934/305216 files (0.1% non-contiguous), 1140469/1219840 blocks
- [root@wgzhao-nb wgzhao]# resize2fs /dev/sda2 20G
- resize2fs 1.41.12 (17-May-2010)
- Resizing the filesystem on /dev/sda2 to 5242880 (4k) blocks.
- The filesystem on /dev/sda2 is now 5242880 blocks long.
我們?cè)賿燧d上來(lái),得到的就是我期望的大小了(20G)
- # df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/sda1 14G 6.5G 7.2G 48% /
- tmpfs 1.4G 296K 1.4G 1% /dev/shm
- /dev/sda2 20G 4.3G 16G 22% /data
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。