Virtualbox中Linux新增一個新磁碟->建立分割槽->格式化->掛載分割槽
引言:我們常常在使用系統的時候突然發現,哎呦~~~我們的磁碟空間不夠用啦!我遇到常見的就是資料庫資料暴增,預留的空間沒有啦,只好新新增磁碟,在VB虛擬機器上就可以實現,往往苦於沒有圖文並茂的好資料,下面我來為大家簡單快捷的實操示範一下,做一名“實操族”偶耶!
一 virtualbox 設定新增磁碟
它會問你,新增虛擬磁碟是要建立一個新檔案來儲存資料,還是選擇一個現有檔案儲存,我們選擇“建立新的虛擬磁碟”
這時又讓你選擇“虛擬磁碟檔案型別”,請注意90%都是選擇VDI(虛擬磁碟映像)型別的,如果你的系統沒有什麼特殊需求,請選擇第一個。點選“下一步”
虛擬磁碟映像檔案的路徑:E:\Vritaulbox\leonarding2.vdi
虛擬磁碟映像檔案的大小:20GB
點選“建立”二 Linux系統進行新磁碟分割槽
[root@leonarding1~]# fdisk –l 檢查現有系統磁碟空間
Disk/dev/sda: 21.4 GB, 21474836480 bytes 這是我們原來的那塊舊磁碟
255 heads, 63sectors/track, 2610 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System 舊磁碟就分了2個分割槽
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
Disk/dev/sdb: 21.4 GB, 21474836480 bytes 這是我們新新增的磁碟/dev/sdb,還沒有分割槽
255 heads, 63sectors/track, 2610 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Disk /dev/sdbdoesn't contain a valid partition table 不包含有效分割槽表資訊,我們需要給新磁碟建立分割槽表
Disk /dev/dm-0:18.2 GB, 18253611008 bytes 下面這些都不用管
255 heads, 63sectors/track, 2219 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Disk /dev/dm-0doesn't contain a valid partition table
Disk /dev/dm-1:3087 MB, 3087007744 bytes
255 heads, 63sectors/track, 375 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Disk /dev/dm-1doesn't contain a valid partition table
[root@leonarding1~]# fdisk /dev/sdb sdb磁碟分割槽,有很多選項,我們選擇m幫助資訊
Device containsneither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOSdisklabel. Changes will remain in memory only,
until you decideto write them. After that, of course, the previous
content won't be recoverable.
The number ofcylinders for this disk is set to 2610.
There is nothingwrong with that, but this is larger than 1024,
and could incertain setups cause problems with:
1) software thatruns at boot time (e.g., old versions of LILO)
2) booting andpartitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalidflag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m forhelp): m 選擇m即可看到幫助資訊
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition 建立一個新分割槽
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m forhelp): n 建立一個新分割槽
Command action
e extended
p primary partition (1-4)
p 選擇p新增主分割槽
Partition number(1-4): 1 選擇主分割槽編號為1, 這樣建立後的主分割槽為sdb1
First cylinder(1-2610, default 1): 選擇格式化分割槽從第幾個柱面開始
Using defaultvalue 1 直接“回車”預設從第1個柱面開始
Last cylinder or+size or +sizeM or +sizeK (1-2610, default 2610): 選擇格式化分割槽從第幾個柱面結束
Using defaultvalue 2610 直接“回車”預設從最後1個柱面結束
我們把所有20GB空間都格式化為一個分割槽了,如果有朋友想劃分多個分割槽,如下方法
Last cylinder or+size or +sizeM or +sizeK (1-2610, default 2610): 以MB為單位輸入自己想要的大小即可
這樣我們就建立完一個分割槽,如果要建立更多分割槽可以照上面的步驟繼續建立。
Command (m forhelp): w 鍵入w,儲存設定並退出,完成新磁碟分割槽表建立
The partitiontable has been altered!
Calling ioctl() tore-read partition table.
Syncing disks.
[root@leonarding1~]# fdisk –l 我們在看一下系統磁碟空間分配情況
Disk /dev/sda:21.4 GB, 21474836480 bytes
255 heads, 63sectors/track, 2610 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
Disk/dev/sdb: 21.4 GB, 21474836480 bytes 這時我們可以看到新磁碟已經加入分割槽表了
255heads, 63 sectors/track, 2610 cylinders
Units =cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux
下面我們給新磁碟的/dev/sdb1分割槽進行格式化操作
[root@leonarding1~]# mkfs -t ext4 /dev/sdb1 用ext4格式對/dev/sdb1分割槽進行格式化
mke4fs 1.41.12(17-May-2010)
Filesystem label=
OS type: Linux 作業系統型別Linux
Block size=4096(log=2) 作業系統塊大小4k
Fragment size=4096(log=2)
Stride=0 blocks,Stripe width=0 blocks
1310720 inodes,5241198 blocks
262059 blocks(5.00%) reserved for the super user
First data block=0
Maximum filesystemblocks=4294967296
160 block groups
32768 blocks pergroup, 32768 fragments per group
8192 inodes pergroup
Superblock backupsstored on blocks:
32768, 98304, 163840, 229376, 294912,819200, 884736, 1605632, 2654208,
4096000
Writing inodetables: done
Creating journal(32768 blocks): done
Writingsuperblocks and filesystem accounting information: done
This filesystemwill be automatically checked every 35 mounts or
180 days,whichever comes first. Use tune4fs -c or-i to override.
到此我們的新分割槽格式化完畢,下面我們就要掛載上分割槽就可以使用啦!
[root@leonarding1~]# df –h 這是我們還沒有掛載新分割槽之前的掛載點分佈
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
17G 15G 1.6G 90% /
/dev/sda1 99M 23M 71M 25% /boot
tmpfs 731M 320M 411M 44% /dev/shm
/dev/sr0 55M 55M 0 100% /media/VBOXADDITIONS_4.2.6_82870
[root@leonarding1/]# mkdir /u02 在根目錄上建立一個新的掛載目錄/u02
[root@leonarding1/]# mount /dev/sdb1 /u02 將新磁碟分割槽掛載到/u02目錄下
[root@leonarding1/]# df –h 這是我們掛載新分割槽之後的掛載點分佈
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
17G 15G 1.6G 90% /
/dev/sda1 99M 23M 71M 25% /boot
tmpfs 731M 320M 411M 44% /dev/shm
/dev/sr0 55M 55M 0 100% /media/VBOXADDITIONS_4.2.6_82870
/dev/sdb1 20G 172M 19G 1% /u02
現在我們可以正常使用新新增的磁碟空間了
[root@leonarding1/]# cd /u02
[root@leonarding1u02]# mkdir app 建立一個app目錄試試
[root@leonarding1u02]# ll
total 20
drwxr-xr-x 2 rootroot 4096 Apr 14 09:12 app ok成功建立木有問題
drwx------ 2 rootroot 16384 Apr 14 08:59 lost+found
到此Virtualbox中Linux新增一個新磁碟->建立分割槽->格式化->掛載分割槽系列操作完畢
Virtualbox 新增磁碟 建立分割槽 格式化 掛載分割槽
開機自動掛載新磁碟分割槽/dev/sdb1
[root@leonarding1 /]# vim /etc/fstab 修改檔案,在檔案最後新增一行
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/sdb1 /u02 ext4 defaults 0 0
這樣在重啟系統後就會自動掛載到/u02目錄上
Leonarding
2013.4.14
天津&spring
分享技術~成就夢想
Blog:www.leonarding.com
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26686207/viewspace-758434/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Virtualbox中Linux新增新磁碟並建立分割槽Linux
- linux 新增磁碟 分割槽掛載Linux
- linux新增新磁碟和建立分割槽Linux
- Linux 磁碟分割槽和掛載Linux
- linux 磁碟分割槽掛載-fdiskLinux
- 在Linux中,如何格式化一個磁碟分割槽?Linux
- linux fdisk 分割槽、格式化、掛載!Linux
- Linux磁碟分割槽及自動掛載Linux
- Linux 分割槽擴容(根分割槽擴容,SWAP 分割槽擴容,掛載新分割槽為目錄)Linux
- 【Linux】MBR磁碟分割槽表只能有四個分割槽?Linux
- linux掛載新硬碟並進行分割槽格式化Linux硬碟
- 在Linux中,如何建立一個分割槽?Linux
- Linux 磁碟與磁碟分割槽Linux
- Linux磁碟分割槽、掛載、檢視檔案大小Linux
- linux磁碟分割槽格式化-fdisk命令工具Linux
- Liunx 磁碟分割槽與檔案掛載
- Linux 新增LVM分割槽及LVM分割槽擴容LinuxLVM
- 大盤分割槽格式化及掛載
- 為linux新增一塊新硬碟並分割槽Linux硬碟
- 9.2 Linux硬碟分割槽和掛載Linux硬碟
- Linux 分割槽和格式化Linux
- 磁碟分割槽管理
- Linux核心之磁碟和分割槽Linux
- 一文全懂:Linux磁碟分割槽Linux
- Linux分割槽方案、分割槽建議Linux
- linux建立新分割槽擴充套件磁碟空間Linux套件
- Mac磁碟如何分割槽?教你Mac系統磁碟自由分割槽教程!Mac
- MySql資料分割槽操作之新增分割槽操作MySql
- 建立sawp分割槽
- MySql建立分割槽MySql
- Linux中什麼是分割槽?Linux分割槽有什麼好處?Linux
- Liunx新增新硬碟和分割槽方法硬碟
- win10增加分割槽的方法_win10怎麼給磁碟新增分割槽Win10
- Linux下磁碟分割槽工具cfdisk的使用Linux
- 在 Linux 中建立 LVM 分割槽的分步指南LinuxLVM
- parted和fdisk——兩種磁碟分割槽並掛載的方法
- Linux硬碟分割槽及開機自動掛載Linux硬碟
- linux分割槽方案Linux
- linux硬碟分割槽Linux硬碟