Linux 从光驱拷贝文件以及加载新的硬盘

-------------------------------------------------------加载光驱---------------------------------------

1.将ISO文件放到光盘中,点击确定;

2.连接光驱

   如果是虚拟机:菜单VM--&gtsetting--&gtHardware--&gt选CD/DVD--&gtConnection

3.将光驱加载到一个目录下,要先mount

[root@lvs-dr1 install]# mkdir /mnt/cdrom
[root@lvs-dr1 install]# ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 Jan 12 13:58 /dev/cdrom -> hdc
[root@lvs-dr1 install]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@lvs-dr1 install]# mount /dev/hdc /mnt/cdrom
mount: block device /dev/hdc is write-protected, mounting read-only
mount: /dev/hdc already mounted or /mnt/cdrom busy
mount: according to mtab, /dev/hdc is already mounted on /mnt/cdrom

4.拷贝数据到新的目录
[root@lvs-dr1 install]# cp /mnt/cdrom /tmp
[root@lvs-dr1 tmp]# ls

然后就可以使用光驱中的问价年了

5.取消加载目录,要先unmount

 [root@lvs-dr1 install]# unmount /dev/cdrom

6.退出光驱

 [root@lvs-dr1] reject

-------------------------------------------------------加载硬盘---------------------------------------

一、过程步骤
1、#kudzu                          //检测新硬件,这一步必须!
2、#fdisk -l                         //查看是否找到新的硬盘,查看硬盘代号。
3、#fdisk /dev/sdb             //为新硬盘分区,例如分成sdb1
     #mkfs.ext3 /dev/sdb1    //把新硬盘格式化成ext3格式
4、#mkdir /disk2                    //创建新的挂载点
5、#mount /dev/sdb1 /disk2/   //手动挂载分区,把硬盘挂到/disk2目录下。
6、#vi /etc/fstab
/dev/sdb1 /disk2 ext3 auto 1 2     //设置为开机自动挂载分区。

二.详细过程

1.检测新硬件

   [root@localhost ~]# kudzu

2.查看硬盘代号

  [root@localhost ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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         144     1052257+  82  Linux swap
/dev/sda3             145        1305     9325732+  83  Linux

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table


3.fdisk 分区


[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): 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): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         261     2096451   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

4.创建挂载点

[root@localhost ~]# mkdir /disk2
[root@localhost ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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         144     1052257+  82  Linux swap
/dev/sda3             145        1305     9325732+  83  Linux

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         261     2096451   83  Linux
[root@localhost ~]# mount /dev/sdb1 /disk2
mount: you must specify the filesystem type
[root@localhost ~]# mkfs -t ext3 -c /dev/sdb1     ---格式化为EXT3格式
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524112 blocks
26205 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost ~]# mount /dev/sdb1 /disk2    --加载

5、设置为开机自动挂载分区

[root@localhost ~]# vi /etc/fstab
/dev/sdb1     /disk2      ext3       auto     1 2

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17179887/viewspace-677391/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/17179887/viewspace-677391/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值