suse linux增加新磁盤分區,Virtualbox中Linux添加新磁盤并創建分區

引言:我們常常在使用系統的時候突然發現,哎呦~~~我們的磁盤空間不夠用啦!我遇到常見的就是數據庫數據暴增,預留的空間沒有啦,只好新添加磁盤,在VB虛擬機上就可以實現,往往苦于沒有圖文并茂的好資料,下面我來為大家簡單快捷的實操示范一下,做一名“實操族”偶耶!

Virtualbox中Linux添加一個新磁盤->創建分區->格式化->掛載分區。

一virtualbox設置添加磁盤

關閉你的虛擬機,掛載新磁盤不可以在開機狀態做

Virtualbox菜單欄->設置->存儲-> SATA控制器->右擊,選擇“添加虛擬硬盤”

5c03eacf2af97e83cc8f00b49842527c.png

注:千萬不要選擇“IDE控制器”這是一種非常古老的并口磁盤,現在已經都淘汰了,請選SATA控制器現在流行的串口磁盤添加。我們點擊紅框框中的“添加虛擬磁盤”按鈕

2068d5059059d8f51349e884634792e6.png

它會問你,添加虛擬磁盤是要創建一個新文件來保存數據,還是選擇一個現有文件保存,我們選擇“創建新的虛擬磁盤”

0821987e8a064e131573be267312e992.png

這時又讓你選擇“虛擬磁盤文件類型”,請注意90%都是選擇VDI(虛擬磁盤映像)類型的,如果你的系統沒有什么特殊需求,請選擇第一個。點擊“下一步”

fdc9bec2398a291cf3b58171c98bacc0.png

選擇“動態分配”磁盤空間,只在需要的時候擴展物理磁盤空間,點擊“下一步”

02ddf1968101da24106b0d5836b149a4.png

虛擬磁盤映像文件的路徑:E:\Vritaulbox\leonarding2.vdi

虛擬磁盤映像文件的大小:20GB

點擊“創建”

b37b383dc2fcfdf4ec2e7bb0d8283f44.png

現在已經創建好了一個新的虛擬磁盤“leonarding2.vdi”,我們啟動系統,virtualbox添加工作已經完成,剩下的就是在Linux系統中給新添加的磁盤->分區。

二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目錄上

0b1331709591d260c1c78e86d0c51c18.png

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542451.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542451.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542451.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Java SecurityManager checkMemberAccess()方法與示例

SecurityManager類的checkMemberAccess()方法 (SecurityManager Class checkMemberAccess() method) checkMemberAccess() method is available in java.lang package. checkMemberAccess()方法在java.lang包中可用。 In checkMemberAccess() method we access public members …

arcgis字段計算器無法賦值_Arcgis空間連接工具的妙用

?Arcgis功能真的無比強大,讀書時一般只會用到一些常見的,工作后挖掘了很多新功能,數據處理效率大幅提升,個人覺得arcgis是最強大最好用的gis軟件!本節給大家分享下空間連接功能的兩個妙用。空間連接功能很多giser應該…

linux重裝hal服務安裝,linux ubuntu 安裝微信客戶端

下載(我的系統是32 位的)rootmarhal:/opt# wget https://github.com/geeeeeeeeek/electronic-wechat/releases/download/V2.0/linux-ia32.tar.gz解壓rootmarhal:/opt# tar xvf linux-ia32.tar.gz下載微信圖標移動到解壓目錄rootmarhal:/home/marhal/下載# mv wechat.ico /opt/e…

currency abap_Java Currency getDefaultFractionDigits()方法及示例

currency abap貨幣類getDefaultFractionDigits()方法 (Currency Class getDefaultFractionDigits() method) getDefaultFractionDigits() method is available in java.util package. getDefaultFractionDigits()方法在java.util包中可用。 getDefaultFractionDigits() method …

python爬蟲自動更換ip_Python 爬蟲使用動態切換ip防止封殺

對于爬蟲被封禁 ! 爬蟲一般來說只要你的ip夠多,是不容易被封的。 一些中小網站要封殺你,他的技術成本也是很高的,因為大多數網站沒有vps,他們用的是虛擬空間或者是sae,bae這樣的paas云。 其實就算他們不考慮…

linux nohup不生成日志,linux重定向及nohup不輸出的方法

FreeBSD可以同時運行多個進程,在shell下直接輸入命令后,shell將進程放到前臺執行。如果要將進程放到后臺執行,需要在命令行的結尾加上一個 “&” 符號。下面的命令從后臺執行,從ftp.isc.org下載文件。$ fetch ftp://ftp.isc.o…

Java BigInteger類| 帶實例的splitAndRemainder()方法

BigInteger類divideAndRemainder()方法 (BigInteger Class divideAndRemainder() method) divideAndRemainder() method is available in java.math package. splitAndRemainder()方法在java.math包中可用。 divideAndRemainder() method returns BigInteger array of 2 elemen…

SpringMVC Mybatis Shiro RestTemplate的實現客戶端無狀態驗證及訪問控制【轉】

2019獨角獸企業重金招聘Python工程師標準>>> A.首先需要搭建SpringMVCShiro環境 a1.pom.xml配置 spring: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId><version>4.1.0.RELEAS…

sql服務器默認密碼_搭建一個DNS服務器,輕松實現域名解析內容分發,訪問速度提高N倍...

DNS服務器&#xff0c;Domain Name Server&#xff0c;域名解析服務器&#xff0c;互聯網上相互通信使用的是IP&#xff0c;但是IP是又長又臭又難記&#xff0c;所以創造了域名來解決IP難寫難記的問題&#xff0c;記一個g.cn比203.208.50.127強過不知多少倍了。有了域名&#x…

在C ++ STL中使用string :: to_string()將數字轉換為字符串

to_string() is a library function of <string> header, it is used to convert numeric value (number) to string. to_string()是<string>標頭的庫函數&#xff0c;用于將數值(數字)轉換為字符串。 Syntax: 句法&#xff1a; string to_string(numberic_value…

門級建模

學習目標 學習Verilog提供的門級原語 理解門的實例引用、門的符號以及and/or&#xff0c;buf/not類型的門的真值表 學習如何根據電路的羅技圖來生成Verilog描述 講述門級設計中的上升、下降和關斷延遲 解釋門級設計中的最小、最大和典型延遲 1.門的類型 1.1與門&#xff08;and…

linux .net 控制臺應用程序,VisualStudioCode創建的asp.net core控制臺程序部署到linux

1、asp.net core控制臺程序static void Main(string[] args){int times10;while(times>0){Console.WriteLine("Hello World!");times--;Thread.Sleep(1000);}}2、發布發布前&#xff0c;修改test2.csproj文件(項目名稱為test2)Exenetcoreapp2.1centos.7-x64主要添…

數組長度屬性以及JavaScript中的示例

JavaScript長度屬性 (JavaScript length property) length property is used to get and set the length of an array in JavaScript. length屬性用于獲取和設置JavaScript中數組的長度。 Syntax to get the length of an array: 獲取數組長度的語法&#xff1a; array_name.…

怎么挖linux內核的漏洞,linux內核漏洞分析實戰看看專家是怎么一步步...-卓優商學院問答...

推薦回答Linux內核調試方法kdb&#xff1a;只能在匯編代碼級進行調試&#xff1b;優點是不需要兩臺機器進行調試。gdb&#xff1a;在調試模塊時缺少一些至關重要的功能&#xff0c;它可用來查看內核的運行情況&#xff0c;包括反匯編內核函數。kgdb&#xff1a;能很方便的在源碼…

COGS182 [USACO Jan07] 均衡隊形[RMQ]

182. [USACO Jan07] 均衡隊形 ★★ 輸入文件&#xff1a;lineup.in 輸出文件&#xff1a;lineup.out 簡單對比時間限制&#xff1a;4 s 內存限制&#xff1a;128 MB 題目描述 農夫約翰的 N (1 ≤ N ≤ 50,000) 頭奶牛&#xff0c;每天擠奶時總會按同樣的順序站好。一日…

string中concat_JavaScript中帶示例的String concat()方法

string中concat字符串concat()方法 (String concat() Method) concat() is a string method in JavaScript, it is used to concatenate (join) two or more strings and returns a new joined string. concat()是JavaScript中的字符串方法&#xff0c;用于連接(聯接)兩個或多個…

linux全自動備份網站到百度云盤,Linux定時備份數據到百度云盤(示例代碼)

導讀&#xff1a;如今的百度云盤免費容量都是2T了&#xff0c;即使把電腦上所有的東東都放上去&#xff0c;也還有大把的剩余空間。對于站長來說&#xff0c;是完全可以充分利用這些硬盤空間的&#xff0c;現在我們就用百度云盤來備份Linux服務器上的數據。一直在想&#xff0c…

python dict底層實現_dict實現原理和哈希表

dict底層實現在Python中&#xff0c;字典是依靠散列表或說哈希表(Hash Table)進行實現的&#xff0c;使用開放地址法解決沖突。所以其查找的時間復雜度會是O(1)&#xff0c;下文會具體講解哈希表的工作原理和解決沖突時的具體方法。也就是說&#xff0c;字典也是一個數組&#…

網際控制報文協議icmp_網絡中的ICMP(Internet控制消息協議)

網際控制報文協議icmpICMP(Internet控制消息協議)簡介 (Introduction to ICMP (Internet Control Message Protocol)) IP (Internet Protocol) is a network layer protocol. The responsibility of delivering data (Logical Addressing) to any network is done by the IP (I…

談色

最近很苦惱&#xff0c;像是到了男人的生理期&#xff0c;或者說是類似動物的發情期&#xff0c;見到露長腿的女人總喜歡看。 其實我是并不喜歡這樣盯著看&#xff0c;或許是男人的本色&#xff0c;十個男人九個色的本性&#xff0c;總是會不自覺的去偷看&#xff0c;更有甚者還…