linux挂载第二硬盘

通过清心醉

linux挂载第二硬盘

[root@MyCloudServer ~]# fdisk -l   //查看硬盘状态
Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000aba6
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2              64        1306     9972736   8e  Linux LVM
Disk /dev/xvdb: 42.9 GB, 42949672960 bytes  //该第二硬盘未挂载
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d68a3
    Device Boot      Start         End      Blocks   Id  System
Disk /dev/mapper/vg_501153278-lv_root: 9135 MB, 9135194112 bytes
255 heads, 63 sectors/track, 1110 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_501153278-lv_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@MyCloudServer ~]# fdisk /dev/xvdb  //对硬盘进行分区
(这特别说明下:因为各个主机VPS的硬盘名不一样
比如作者租的第一个VPS主机
第一硬盘:/dev/sda  第二硬盘:/dev/sdb 很明显是ab来区分,所以根据硬盘符号来进行适当修改
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
         switch off the mode (command ‘c’) and change display units to
         sectors (command ‘u’).
Command (m for help): n  //新增分区
Command action
   e   extended
   p   primary partition (1-4)
p     //主分区
Partition number (1-4): 1  //分区号为1
First cylinder (1-5221, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221):
Using default value 5221
Command (m for help): t  //分区格式
Selected partition 1
Hex code (type L to list codes): 8e  //LVM格式
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w  //保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@MyCloudServer ~]# reboot //重启LINUX
Broadcast message from root@MyCloudServer
        (/dev/pts/0) at 0:47 …
The system is going down for reboot NOW!
[root@MyCloudServer ~]#

至于挂载: 一般 mount /dev/sdb1 /opt/lampp
有时需要指定类型的话,因为上面的挂载为ext3
所以输入
mount -t ext3 /dev/xvdb1 /opt/lampp

df -h可以查看已经挂载的硬盘

关于作者

清心醉 administrator

发表评论

如果喜欢作者的文章,您可以打赏给作者:

TRC20(虚拟货币):


ERC20(虚拟货币):


Bitcoin(BTC):