转载请注明: 转载自Life吧 本文永久链接地址:http://www.lifeba.org/arch/linux_mount_disk.html
1. 查看未挂载的磁盘
[root@localhost ~]# fdisk -l
Disk /dev/sda: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 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 36472 292856917+ 8e Linux LVM
Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
从查询结果看出,有一个/dev/sdb的盘未挂载
2. 用fdisk 对/dev/sdb 进行分区
[root@localhost ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 36472.
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): 1
First cylinder (1-36472, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-36472, default 36472):
Using default value 36472
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
再次查看分区情况,多出来一个/dev/sdb1 的区,这个1是我们在前面指定的,如果我们指定2,就变成 sdb2了。
[root@localhost ~]# fdisk -l
Disk /dev/sda: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 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 36472 292856917+ 8e Linux LVM
Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 36472 292961308+ 83 Linux
3. 格式化 /dev/sdb1 分区
[root@localhost ~]# 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)
36634624 inodes, 73240327 blocks
3662016 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2236 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4. 创建data目录并将 /dev/sdb1 挂在到该目录下
[root@localhost ~]# ls /
bin dev home lib64 media mnt opt root selinux sys usr
boot etc lib lost+found misc net proc sbin srv tmp var
[root@localhost /]# mkdir /data
[root@localhost /]# mount /dev/sdb1 /data
5. 验证挂载是否成功
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
254G 2.8G 238G 2% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 12G 0 12G 0% /dev/shm
/dev/sdb1 276G 192M 261G 1% /data
6. 设置开机自动挂载
[root@localhost /]# vi /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 /data ext3 defaults 1 2
相关推荐
Linux下挂载新硬盘方法
主要介绍了详解Linux下挂载新硬盘方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
4. 创建目录 并将 /dev/sdb1 挂在到该目录下 [root@db1 /]# ls backup dev initrd media opt sbin sys usr bin etc lib misc proc selinux tftpboot var boot home lost+found mnt root...
在linux系统下使安装tfs-3g软件,识别和挂载ntfs分区格式的硬盘
讲解linux系统硬盘不足时挂载硬盘的方法
本文介绍了Linux系统下挂载USB硬盘的解决方法。
Unix/linux 挂载 usb 移动硬盘 命令 看完包你知道怎么在unix或者linux下挂载各种设备。
linux挂载新硬盘,开机自动挂载.
介绍了 linux下挂载优盘和硬盘的一般方法,方便初学着学习。
linux上挂载卸载u盘、硬盘不像windows上这么方便,不过,只要记住命令的话,也就得心应手了。
Linux下挂载硬盘之后,系统启动之后硬盘跟随系统自启动,不用手动设置
linux下挂载ntfs硬盘所需软件fuse-2.7.4.tar.gz及ntfs-3g-2009.4.4.gz
linux下挂载移动硬盘。linux查看Windows系统中的ntfs分区。
linux挂载NTFS硬盘格式工具,解压包内含挂载教程
Linux磁盘挂载是比较常见的对linux系统管理的操作之一,需要耐心才能正确实现自动挂载,便于日后提高...首先,为了需要,新添加一块磁盘到linux主机中,目的是让这个新添加的磁盘分区格式化并可以随系统启动自动挂载。
数据迁移是我们经常会遇到的,有时候做大数据量迁移时,为了快速迁移大数据,有可能在Linux服务器上临时挂载NTFS格式的移动硬盘, 一般情况下,Linux是识别不了NTFS格式移动硬盘的(需要重编译Linux核心才能,加挂...
linux 系挂载大于16T分区,文件系统ext4格式突破限制16T分区大小限制。
Linux挂载硬盘的步骤.zip
手把手教你挂载linux下挂载硬盘分享.pdf