mount 挂载1T硬盘

参考链接:http://blog.chinaunix.net/uid-25829053-id-3067619.html

http://blog.itpub.net/23718752/viewspace-1146471/

192.168.20.249挂载1T硬盘

1 fdisk -l #查看要挂载的硬盘容量

显示如下:

Disk /dev/sdb: 999.7 GB

2 fdisk /dev/sdb   #创建分区

m 打印帮助菜单

p 显示分区/打印分区

d 删除分区

n 新建分区

3 格式化

mkfs -t ext4 /dev/sdb1

具体操作如下:

[email protected]:/opt/backup# fdisk -l

Disk /dev/sda: 599.6 GB, 599550590976 bytes

255 heads, 63 sectors/track, 72891 cylinders, total 1170997248 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0006ca04

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048  1137901567   568949760   83  Linux

/dev/sda2      1137903614  1170995199    16545793    5  Extended

/dev/sda5      1137903616  1170995199    16545792   82  Linux swap / Solaris

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1048578047   524288000   83  Linux

/dev/sdb2      1952448511  1952448511           0+  83  Linux    #这里的0+表示该分区容量为0,分区划分的有问题

[email protected]:/opt/backup# fdisk /dev/sdb   #重新划分分区

Command (m for help): p  #打印分区

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1048578047   524288000   83  Linux

/dev/sdb2      1952448511  1952448511           0+  83  Linux

Command (m for help): d  #删除分区,

Partition number (1-4): 1   #选择删除哪个分区

Command (m for help): p

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb2      1952448511  1952448511           0+  83  Linux

Command (m for help): d  #默认删除第二个分区

Selected partition 2

Command (m for help): p  #打印分区表

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n    #新建分区

Partition type:

p   primary (0 primary, 0 extended, 4 free)

e   extended

Select (default p): p   #划分主分区

Partition number (1-4, default 1): 1   #选择1

First sector (2048-1952448511, default 2048):    #此处默认回车即可

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-1952448511, default 1952448511): +600G

Command (m for help): n  #新建分区

Partition type:

p   primary (1 primary, 0 extended, 3 free)

e   extended

Select (default p): p  #划分主分区

Partition number (1-4, default 2): 2  #选择2

First sector (1258293248-1952448511, default 1258293248):   此处默认回车

Using default value 1258293248

Last sector, +sectors or +size{K,M,G} (1258293248-1952448511, default 1952448511): +390G

Value out of range.       #报超出范围

Last sector, +sectors or +size{K,M,G} (1258293248-1952448511, default 1952448511): +330G  #不报错

Command (m for help): p   #打印分区

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

/dev/sdb2      1258293248  1950353407   346030080   83  Linux

Command (m for help): d     #删除第二个分区

Partition number (1-4): 2

Command (m for help): p

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

Command (m for help): n    #新建分区

Partition type:

p   primary (1 primary, 0 extended, 3 free)

e   extended

Select (default p): p   #创建主分区

Partition number (1-4, default 2): 2

First sector (1258293248-1952448511, default 1258293248):   默认回车

Using default value 1258293248

Last sector, +sectors or +size{K,M,G} (1258293248-1952448511, default 1952448511): 1258293248   #选择了起始值

Command (m for help): p  #打印分区

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

/dev/sdb2      1258293248  1258293248           0+  83  Linux      #显示该分区容量为0

Command (m for help): d   #删除第二个分区

Partition number (1-4): 2

Command (m for help): p  #打印分区表

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

Command (m for help): n   #新建分枢

Partition type:

p   primary (1 primary, 0 extended, 3 free)

e   extended

Select (default p): p  #主分区

Partition number (1-4, default 2): 2

First sector (1258293248-1952448511, default 1258293248):  #此处默认回车

Using default value 1258293248

Last sector, +sectors or +size{K,M,G} (1258293248-1952448511, default 1952448511): 1952448511  #输入末位的这个值

Command (m for help): p  #打印分区

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

/dev/sdb2      1258293248  1952448511   347077632   83  Linux

Command (m for help): w   #保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

格式化分区

mkfs -t ext4 /dev/sdb1

mkfs -t ext4 /dev/sdb2

挂载

mount /dev/sdb1 /opt/backup/online/

mount /dev/sdb2 /opt/backup/offline/

[email protected]:/opt/backup# df -Th   #查看硬盘容量

Filesystem     Type      Size  Used Avail Use% Mounted on

/dev/sda1      ext4      534G  1.5G  506G   1% /

none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup

udev           devtmpfs  7.8G  4.0K  7.8G   1% /dev

tmpfs          tmpfs     1.6G  1.1M  1.6G   1% /run

none           tmpfs     5.0M     0  5.0M   0% /run/lock

none           tmpfs     7.8G  4.0K  7.8G   1% /run/shm

none           tmpfs     100M     0  100M   0% /run/user

/dev/sdb1      ext4      591G   70M  561G   1% /opt/backup/online    #999.7 GB的盘,挂上来之后只有870G

/dev/sdb2      ext4      326G   67M  310G   1% /opt/backup/offline

卸载

umount /opt/backup/online

umount /opt/backup/offline

[email protected]:/opt/backup# df -Th   #查看硬盘容量   已成功卸载

Filesystem     Type      Size  Used Avail Use% Mounted on

/dev/sda1      ext4      534G  1.5G  506G   1% /

none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup

udev           devtmpfs  7.8G  4.0K  7.8G   1% /dev

tmpfs          tmpfs     1.6G  1.1M  1.6G   1% /run

none           tmpfs     5.0M     0  5.0M   0% /run/lock

none           tmpfs     7.8G  4.0K  7.8G   1% /run/shm

none           tmpfs     100M     0  100M   0% /run/user

以下是最简便的划分分区方法:即只划分一个分区

[email protected]:/opt/backup# fdisk -l  #查看分区情况

Disk /dev/sda: 599.6 GB, 599550590976 bytes

255 heads, 63 sectors/track, 72891 cylinders, total 1170997248 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0006ca04

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048  1137901567   568949760   83  Linux

/dev/sda2      1137903614  1170995199    16545793    5  Extended

/dev/sda5      1137903616  1170995199    16545792   82  Linux swap / Solaris

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux     #第二盘有两个分区

/dev/sdb2      1258293248  1952448511   347077632   83  Linux

[email protected]:/opt/backup# fdisk /dev/sdb      #对第二块盘重新分区

Command (m for help): p  #打印分区

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048  1258293247   629145600   83  Linux

/dev/sdb2      1258293248  1952448511   347077632   83  Linux

Command (m for help): d   #删除分区

Partition number (1-4): 1

Command (m for help): d

Selected partition 2

Command (m for help): p

Disk /dev/sdb: 999.7 GB, 999653638144 bytes

2 heads, 1 sectors/track, 976224256 cylinders, total 1952448512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x27638d58

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n  #新建分区

Partition type:

p   primary (0 primary, 0 extended, 4 free)

e   extended

Select (default p): p  #主分区

Partition number (1-4, default 1): 1

First sector (2048-1952448511, default 2048):    #此处默认回车

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-1952448511, default 1952448511): 1952448511   #写默认最后边的数

Command (m for help): w  #保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

格式化

mkfs -t ext4 /dev/sdb1

挂载

mount /dev/sdb1 /opt/backup/

查看硬盘容量

[email protected]:/opt/backup# df -Th

Filesystem     Type      Size  Used Avail Use% Mounted on

/dev/sda1      ext4      534G  1.5G  506G   1% /

none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup

udev           devtmpfs  7.8G  4.0K  7.8G   1% /dev

tmpfs          tmpfs     1.6G  1.1M  1.6G   1% /run

none           tmpfs     5.0M     0  5.0M   0% /run/lock

none           tmpfs     7.8G  4.0K  7.8G   1% /run/shm

none           tmpfs     100M     0  100M   0% /run/user

/dev/sdb1      ext4      917G   72M  870G   1% /opt/backup    #查看硬盘容量也是870G

配置开机启动项

vi /etc/fstab

/dev/sdb1       /opt/backup     ext4    defaults        1       2

/dev/sdb1   代表哪个分区

/opt/backup 挂载的位置

ext4  是该分区的格式

defaults  是挂载时所要设定的参数(只读,读写,启用quota等),

输入defaults包括的参数有(rw、dev、exec、auto、nouser、async) ,

1 是使用dump是否要记录,0是不要。

2 是开机时检查的顺序,是boot系统文件就为1,其他文件系统都为2,如不要检查就为0

时间: 2024-10-11 06:01:03

mount 挂载1T硬盘的相关文章

Linux mount挂载和卸载硬盘脚本分享

Linux 挂载 [[email protected] ~]# mount /dev/sdb5 /mnt/ [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 16G 2.1G 13G 14% / tmpfs 931M 0 931M 0% /dev/shm /dev/sda1 194M 28M 157M 16% /boot /dev/sdb5 2.0G 68M 1.9G 4% /mnt

linux使用mount挂载硬盘

linux使用mount挂载硬盘 有关linux系统中挂载硬盘,使用monut命令挂载硬盘. 例子:su /sbin/fdisk -l fdisk /dev/sdb n, p,1,<cr> ,<cr> 保存完成后重启服务器(www.jbxue.com 脚本学堂) /dev/sdb1 mkfs -t ext3 -c /dev/sdb1 如果不了解mount命令如何使用,可以参阅 linux挂载命令mount的用法,有关于mount命令的详细介绍. 手工 mount:mount /de

mount挂载,dd 工具,配置配额系统,RAID阵列,逻辑卷管理器LVM

mount mount挂载 vim /etc/fstab 将常用的挂载的设备写入系统表中 文件挂载配置文件 /etc/fstab /etc/fstab每行定义一个要挂载的文件系统: 要挂载的设备或伪文件系统 挂载点 文件系统类型 挂载选项 转储频率 自检次序 要挂载的设备或伪文件系统: 设备文件.LABEL(LABEL="").UUID(UUID="").伪文件系统名称(proc, sysfs) 挂载选项:defaults 转储频率:0:不做备份 每天转储 每隔一天

linux挂载新硬盘,开机自动挂载

Linux的硬盘识别: 2.6 kernel以后,linux会将识别到的硬件设备,在/dev/下建立相应的设备文件.如: sda        表示第1块SCSI硬盘.# V, z   b, }2 F7 u' | hda        表示第1块IDE硬盘(即连接在第1个IDE接口的Master口上) scd0        表示第1个USB光驱. 当添加了新硬盘后,在/dev目录下会有相应的设备文件产生.cciss的硬盘是个例外,它的 设备文件在/dev/cciss/目录下.一般使用"fdis

hadoop挂载多硬盘,ZZ

hadoop挂载多硬盘 ...multiple disks per node multiple disks per node Read more at: http://www.queryhome.com/24784/how-to-set-hadoop-tmp-dir-if-i-have-multiple-disks-per-node multiple disks per node Read more at: http://www.queryhome.com/24784/how-to-set-ha

linux 挂载新硬盘

fdisk 对硬盘及分区的操作,进入fdisk 对硬盘操作阶段 我们可以对硬盘进行分区操作,前提是您把fdisk -l 弄明白了:通过fdisk -l ,我们能找出机器中所有硬盘个数及设备名称:比如上面的例子,我们会看到两个设备一个是/dev/hda ,另一个是/dev/sda : fdisk 操作硬盘的命令格式如下: [[email protected] beinan]# fdisk 设备 比如我们通过 fdisk -l 得知 /dev/hda 或者 /dev/sda设备:我们如果想再添加或者

mount挂载WINDOWS分区和目录

转自:http://blog.163.com/sg_liao/blog/static/29577083200942811445981/ 一,挂载共享目录 sudo mount -t cifs  -o username=liaoxiaohui,password=l23456,iocharset=utf8 //server/share /mnt sudo:切换管理员执行 mount:挂载命令 -t cifs  CIFS就是WINDOWS的共享协议, -o:用户信息 username=用户名,pass

mount挂载img文件

使用mount挂载ubuntu虚拟机所在的img文件的时候,执行: "sudo mount -o loop xxx.img /mnt/xxx", 系统提示: "mount: you must specify the filesystem type" 加上"-t ext3″后仍然报错: mount  : wrong fs  type  , bad option, bad superblock on  /dev/loop2  ,    missing code

Linux 下挂载新硬盘方法(转)

1.关闭服务器加上新硬盘   2.启动服务器,以root用户登录   3.查看硬盘信息 #fdisk -l [cpp] view plain copy Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 byt