linux挂载新硬盘和分区步骤

[[email protected]]# uname -a

Linuxlocalhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011x86_64 x86_64 x86_64 GNU/Linux

[[email protected]]# cat system-release

CentOS release 6.2(Final)

[[email protected]]#

先挂载了一个3G的硬盘查看磁盘空间的情况

[[email protected]]# fdisk -l

Disk /dev/sda: 42.9GB, 42949672960 bytes

255 heads, 63sectors/track, 5221 cylinders

Units = cylinders of16065 * 512 = 8225280 bytes

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

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

Disk identifier:0x0004daae

DeviceBoot      Start         End     Blocks   Id  System

/dev/sda1   *          1          39     307200   83  Linux

Partition 1 does notend on cylinder boundary.

/dev/sda2             39        4998   39832576   83  Linux

/dev/sda3           4998        5222    1802240   82  Linux swap / Solaris

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63sectors/track, 391 cylinders

Units = cylinders of16065 * 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/sdb doesn‘t contain a validpartition table

划分磁盘分区,分为4个主分区,最后写入磁盘。

[[email protected]]# fdisk /dev/sdb

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 forhelp): 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

Partitionnumber (1-4): 4

First cylinder(1-391, default 1): 1

Last cylinder,+cylinders or +size{K,M,G} (1-391, default 391): 100

Command (m forhelp): n

Command action

e  extended

p  primary partition (1-4)

p

Partition number(1-4): 2

First cylinder(101-391, default 101): 101

Last cylinder,+cylinders or +size{K,M,G} (101-391, default 391): 200

Command (m forhelp): n

Command action

e  extended

p  primary partition (1-4)

p

Partition number(1-4): 3

First cylinder(201-391, default 201): 201

Last cylinder,+cylinders or +size{K,M,G} (201-391, default 391): 300

Command (m forhelp): n

Command action

e  extended

p  primary partition (1-4)

p

Selected partition 1

First cylinder(301-391, default 301): 301

Last cylinder,+cylinders or +size{K,M,G} (301-391, default 391): 391

Command(m for help): w

The partition tablehas been altered!

Calling ioctl() tore-read partition table.

Syncing disks.

[[email protected]]# fdisk -l

再次查看分区情况,

Disk /dev/sdb: 3221MB, 3221225472 bytes

255 heads, 63sectors/track, 391 cylinders

Units = cylinders of16065 * 512 = 8225280 bytes

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

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

Disk identifier:0xe5f51a7b

DeviceBoot      Start         End     Blocks   Id  System

/dev/sdb1             301         391      730957+  83  Linux

/dev/sdb2             101         200      803250   83  Linux

/dev/sdb3             201         300      803250   83  Linux

/dev/sdb4               1         100      803218+  83  Linux

Partition tableentries are not in disk order

我就格式化第一个分区,采用文件系统ext3.

[[email protected]]# mkfs -t ext3 /dev/sdb1

mke2fs 1.41.12(17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096(log=2)

Fragment size=4096(log=2)

Stride=0 blocks,Stripe width=0 blocks

45696 inodes, 182739blocks

9136 blocks (5.00%)reserved for the super user

First data block=0

Maximum filesystemblocks=188743680

6 block groups

32768 blocks pergroup, 32768 fragments per group

7616 inodes pergroup

Superblock backupsstored on blocks:

32768, 98304, 163840

Writing inodetables: done

Creating journal(4096 blocks): done

Writing superblocksand filesystem accounting information: done

This filesystem willbe automatically checked every 27 mounts or

180 days, whichevercomes first.  Use tune2fs -c or -i to override.

创建一个临时目录,然后把分区挂载到这个目录下。

[[email protected] /]#mkdir test

[[email protected] /]#mount /dev/sdb1 /test

挂载后查看磁盘情况,就可以看到分区就在那了。

[[email protected] /]#df -h

Filesystem           Size  Used Avail Use% Mounted on

/dev/sda2             38G   32G  4.3G  89% /

tmpfs                980M  288K  980M   1%/dev/shm

/dev/sda1            291M   32M  244M  12% /boot

/dev/sdb1             703M   17M  651M   3% /test

配置开机启动项

vi /etc/fstab

LABEL=SWAP-sda2        swap                   swap    defaults       0 0

加入如下

/dev/sdb1              /test                   ext3    defaults       1 1

~

5.   第5列为dump选项,设置是否让备份程序dump备份文件系统,0为忽略,1为备份。

6.   第6列为fsck选项,告诉fsck程序以什么顺序检查文件系统,0为忽略。

时间: 2024-08-29 05:26:26

linux挂载新硬盘和分区步骤的相关文章

Linux挂载新硬盘和创建Swap分区的方法

Liunx添加新硬盘其实和Windows的操作一样,但一个是图形化操作,另一个是命令行操作,不过步骤是一样,下面就动手演示和讲解 Linux挂载新硬盘 1.查看硬盘信息 命令:fdisk -l [[email protected] ~]# fdisk -l Disk /dev/vda: 21.5 GB, 21474836480 bytes #第一块硬盘的信息和分区信息 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of

linux 挂载新硬盘

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

linux挂载新硬盘

在服务器上把硬盘接好,启动linux,以root登陆. 比如我新加一块SCSI硬盘,需要将其分成三个区: #fdisk /dev/sdb 进入fdisk模式: Command (m for help):p  //查看新硬盘的分区 Command (m for help):n  //创建新分区 可以用m命令来看fdisk命令的内部命令:n命令创建一个新分区:d命令删除一个存在的分区:p命令显示分区列表:t命令修改分区的类型ID号:l命令显示分区ID号的列表:a命令指定启动分区:w命令是将对分区表的

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

Linux添加新硬盘、分区、格式化、自动挂载

第一步:创建分区 root# fdisk  /dev/had        à进入到新添加的硬盘中 The number of cylinders for this disk is set to 10402. 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 ti

Linux添加新硬盘及分区,格式化,挂载

1.查看分区信息: [[email protected] /]# fdisk -l Disk /dev/vdb: 209.7 GB, 209715200000 bytes16 heads, 63 sectors/track, 406349 cylindersUnits = cylinders of 1008 * 512 = 516096 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/opti

Linux添加新硬盘自动挂载硬盘

Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes 2.格式化硬盘 #mkfs -t ext4 /dev/sdb 3.挂载硬盘 #mount 硬盘地址 要挂载的地址 #mount /dev/sdb /media/imgs 4.实现系统重启后自动挂载该分区 #vi /etc/fstab 在最后一行添加 /dev/sdb /me

Linux下挂载新硬盘方法

?? Linux的硬盘识别在/dev/下建立相应的设备文件.如 sda 表示第一块SCSI硬盘 hda 表示第一块IDE硬盘(即连接在第一个IDE接口的Master口上) scd0 表示第一个USB光驱通过fdisk -l 查看当前的设备和分区信息.注意,新硬盘没有分区信息,只是显示硬盘大小信息 分区并进行格式 使用fdisk命令对sdb进行分区 [[email protected] ~]# fdisk /dev/sdb 输入:n 表示新建分区 Command(m for help):n Com

linux 挂载新的硬盘

linux 挂载新的硬盘 1.查看硬盘情况,物理盘和分区 fdisk -l 2.分区一个盘,sdb是个还没有分区的硬盘 fdisk /dev/sdb 输入 n p 1 w n 表示新建分区 p 表示分区类型为主分区 1 表示分区编号为1 w表示保存并退出fdisk命令 3.格式化分区 mkfs.ext4 /dev/sdb1 4.挂载分区 mkdir /download mount /dev/sdb1 /download 5.查看分区情况 df -h 原文地址:https://www.cnblog