在Linux系统中添加硬盘,并挂载到已有的目录
以如下为例:
环境说明:Linux RedHat4 Updata4,加载6块SAS硬盘,做一个Raid5.挂载到/home/trsmanager目录,要求保证目录中原有数据完好
已经建好的TRS全文检索,放在/home/trsmanager中,想要将扩展的硬盘空间挂载到trsmanager文件夹上,并保证全文检索正常。
方法:将添加上的硬盘使用Linux的fdisk制作一个文件系统,挂载到已有目录下。
[root@TRS01 home]# ls
lost+found trsmanager
[root@TRS01 home]# ls
lost+found trsmanager
[root@TRS01 home]# cd t*
[root@TRS01 trsmanager]# ls
trshome
[root@TRS01 trsmanager]# cd ..
[root@TRS01 home]# tar cvf trsmanager.tar trsmanager #将本来的文件夹trsmanager打包保存。(后续将原来的trsmanager清空,挂载建立好的文件系统,然后将打包的东西解压到这个目录中,还原trsmanager文件夹中的文件)。
[root@TRS01 home]# ls #ls查看并确定打包完成
lost+found trsmanager trsmanager.tar
[root@TRS01 home]# rm -rf trsmanager #删除linux命令查看文件夹大小trsmanager文件夹
[root@TRS01 home]# ls
lost+found trsmanager.tar
[root@TRS01 home]#
[root@TRS01 home]#
[root@TRS01 /]# fdisk –l #查看raid后的硬盘
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 257 1048544 83 Linux
/dev/cciss/c0d0p2 258 5397 20971200 83 Linux
/dev/cciss/c0d0p3 5398 10537 20971200 83 Linux
/dev/cciss/c0d0p4 10538 35132 100347600 5 Extended
/dev/cciss/c0d0p5 10538 15677 20971184 83 Linux
/dev/cciss/c0d0p6 15678 20817 20971184 83 Linux
/dev/cciss/c0d0p7 20818 22873 8388464 83 Linux
/dev/cciss/c0d0p8 22874 24929 8388464 82 Linux swap
/dev/cciss/c0d0p9 24930 35132 41628224 83 Linux
Disk /dev/cciss/c0d1: 733.9 GB, 733910294528 bytes
255 heads, 32 sectors/track, 175664 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes #raid后的硬盘
Device Boot Start End Blocks Id System
[root@TRS01 /]# fdisk /dev/cciss/c0d1 #此处的/dev/cciss/c0d1即为上面查看的raid后的Disk 名称
The number of cylinders for this disk is set to 175664.
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): m #此处输入 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 for help): n #输入n,新建一个磁盘分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1 #输入1,即为主磁盘分区
First cylinder (1-175664, default 1): 1 #输入1
Last cylinder or +size or +sizeM or +sizeK (1-175664, default 175664): #回车
Using default value 175664
Command (m for help): p # print the partition table
Disk /dev/cciss/c0d1: 733.9 GB, 733910294528 bytes
255 heads, 32 sectors/track, 175664 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d1p1 1 175664 716709104 83 Linux
Command (m for help): w #写保存并退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@TRS01 /]# fdisk –l #查看是否已建好逻辑磁盘
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 257 1048544 83 Linux
/dev/cciss/c0d0p2 258 5397 20971200 83 Linux
/dev/cciss/c0d0p3 5398 10537 20971200 83 Linux
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论