新增磁碟並掛載磁碟
當磁碟空間不足的情況下,需要向系統中另外新增一塊磁碟,補充空間不足,
避免資料庫收檔案系統空間不足而不能正常運作。以下是新增新磁碟的過程:
在虛擬機器新增一塊10G的磁碟之後,重啟虛擬機器:
---檢視磁碟的情況:
[root@su ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 535 4192965 82 Linux swap / Solaris
/dev/sda3 536 2610 16667437+ 83 Linux
#目前只有一塊磁碟分3個分割槽。
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@su ~]#
---對新的磁碟進行分割槽:
[root@su ~]# 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 1305.
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-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): 326
Command (m for help): w
The partition table has been altered!
#分了第一塊出來:
--繼續分第二塊:
[root@su ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 1305.
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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (327-1305, default 327):
Using default value 327
Last cylinder or +size or +sizeM or +sizeK (327-1305, default 1305):
Using default value 1305
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.
Syncing disks.
[root@su ~]#
--檢視第二塊磁碟的分割槽情況:
[root@su ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 535 4192965 82 Linux swap / Solaris
/dev/sda3 536 2610 16667437+ 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 326 2618563+ 83 Linux
/dev/sdb2 327 1305 7863817+ 83 Linux
[root@su ~]#
#現在有兩塊磁碟,第一塊磁碟3個分割槽,第二塊磁碟2個分割槽。
--- 格式化已分割槽的磁碟:
[root@su ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
327680 inodes, 654640 blocks
32732 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=671088640
20 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@su ~]#
#格式化完成。
---掛載檔案系統:
--把第一分割槽掛載到/data的目錄下:
--建立一個目錄data:
[root@su ~]# mkdir /data
[root@su ~]# ls -l / |grep data
drwxr-xr-x 2 root root 4096 Nov 8 20:33 data
[root@su ~]# mount /dev/sdb1 /data
[root@su ~]#
[root@su ~]# cd /data/
[root@su data]# ls
lost+found
[root@su data]#
#進入到目錄檢視,其中顯示lost+found,則手動掛載成功。
--可設定自動掛載:
----設定磁碟自動掛載:
[root@su ~]# vi /etc/fstab
LABEL=/ / 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
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sdb1 /data ext3 defaults 0 0
~
#儲存就自動掛載成功。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2129260/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux 新增磁碟 分割槽掛載Linux
- ubuntu磁碟掛載Ubuntu
- Centos 磁碟掛載CentOS
- liunx磁碟掛載操作
- 磁碟掛載mount,umount
- Linux 掛載磁碟Linux
- 開機掛載磁碟
- ecs centos 掛載磁碟CentOS
- Linux磁碟掛載 轉Linux
- Linux下磁碟掛載Linux
- parted和fdisk——兩種磁碟分割槽並掛載的方法
- centos7.x掛載磁碟CentOS
- centos上掛載新的磁碟CentOS
- LInux掛載windows共享磁碟LinuxWindows
- linux中磁碟的掛載Linux
- 磁碟組不能自動掛載
- Linux掛載ISCSI TARGET磁碟Linux
- CentOS7 磁碟掛載操作CentOS
- Ubuntu-22.04 掛載磁碟Ubuntu
- CentOS7.X磁碟掛載及取消掛載CentOS
- Linux(centos)手動掛載系統磁碟和自動掛載系統磁碟教程LinuxCentOS
- 【ASM】Oracle asm磁碟被格式化,如何掛載該磁碟組ASMOracle
- Linux 磁碟分割槽和掛載Linux
- linux 磁碟分割槽掛載-fdiskLinux
- HDFS免重啟掛載新磁碟
- ASM磁碟組不能自動掛載ASM
- 新增磁碟多連路磁碟併為ASM磁碟組擴容ASM
- solaris新增硬碟並掛載硬碟
- 阿里雲購買磁碟後掛載阿里
- linux磁碟掛載與解除安裝Linux
- Liunx 磁碟分割槽與檔案掛載
- windows系統掛載OraCFS型別磁碟Windows型別
- wmware共享磁碟redhat 5.8掛載問題Redhat
- 掛載已有資料的LVM磁碟LVM
- OracleRAC新增asm磁碟組並設定歸檔位置OracleASM
- 虛擬機器磁碟不足,新增磁碟擴容虛擬機
- asm新增刪除磁碟ASM
- linux下新增磁碟Linux