Redhat Enterprise linux 5挂载新的硬盘 精简步骤
 
步骤
一、在vm下新加一个硬盘,linux重启[root@localhost ~]# reboot
二、在/dev/sdb 下新建磁盘,保持设置
[root@localhost dev]# fdisk /dev/sdb
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044
 
Command (m for help): w  //保存生效
 
三、格式化磁盘区间
[root@localhost dev]# mkfs.ext3 /dev/sdb1
 
四、加载到系统启动项(重启磁盘自动挂载)
[root@localhost dev]# mkdir /mnt/sdb1
[root@localhost dev]# mount /dev/sdb1 /mnt/sdb1
[root@localhost dev]# reboot
 
 
 
Redhat Enterprise linux 5挂载新的硬盘 详细过程
 
一、vm下新加一个硬盘,linux重启[root@localhost ~]# reboot
 
vm下的实验
Vm—虚拟机设置
 
[root@localhost ~]# reboot
 
 
二、在/dev/sdb 下新建磁盘,保持设置
[root@localhost ~]# cd /dev
[root@localhost dev]# ls
adsp        fd0u1680    initctl  midi      ram1     rawctl      stdout  tty21  tty37  tty52  ttyS1           vcsa1
agpgart     fd0u1722    input    mixer     ram10    root        systty  tty22  tty38  tty53  ttyS2           vcsa2
audio       fd0u1743    kmsg     net       ram11    rtc         tty     tty23  tty39  tty54  ttyS3           vcsa3
autofs      fd0u1760    log      null      ram12    sda         tty0    tty24  tty4   tty55  urandom         vcsa4
bus        fd0u1840    loop0    nvram     ram13    sda1        tty1    tty25  tty40  tty56  usbdev1.1_ep00  vcsa5
cdrom      fd0u1920    loop1    oldmem    ram14    sda2        tty10   tty26  tty41  tty57  usbdev1.1_ep81  vcsa6
cdrom-hdc  fd0u360     loop2    par0      ram15    sda3        tty11   tty27  tty42  tty58  usbdev2.1_ep00  vcsa7
console     fd0u720     loop3    parport0  ram2     sdb         tty12   tty28  tty43  tty59  usbdev2.1_ep81  vmci
core       fd0u800     loop4    parport1  ram3     sequencer   tty13   tty29  tty44  tty6   vcs             vsock
disk       fd0u820     loop5    parport2  ram4     sequencer2  tty14   tty3   tty45  tty60  vcs1            X0R
dmmidi     fd0u830     loop6    parport3  ram5     sg0         tty15   tty30  tty46  tty61  vcs2            zero
dsp        floppy      loop7    port      ram6     sg1         tty16   tty31  tty47  tty62  vcs3
fd         floppy-fd0  lp0      ppp       ram7     shm         tty17   tty32  tty48  tty63  vcs4
fd0        full        MAKEDEV  ptmx      ram8     snapshot    tty18   tty33  tty49  tty7   vcs5
fd0u1040   gpmctl      mapper   pts       ram9     snd         tty19   tty34  tty5   tty8   vcs6
fd0u1120   hdc         md0      ram       ramdisk  stderr      tty2    tty35  tty50  tty9   vcs7
fd0u1440   hpet        mem      ram0      random   stdin       tty20   tty36  tty51  ttyS0  vcsa
[root@localhost dev]# fdisk -l
 
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1521    12217401   83  Linux
/dev/sda2            1522        1553      257040   83  Linux
/dev/sda3            1554        1566      104422+  82  Linux swap / Solaris
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdb doesn't contain a valid partition table
[root@localhost dev]#
[root@localhost dev]# 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.
 
 
The number of cylinders for this disk is set to 1044.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044
 
Command (m for help): w  //保存生效
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost dev]# fdisk -l
 
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1521    12217401   83  Linux
/dev/sda2            1522        1553      257040   83  Linux
/dev/sda3            1554        1566      104422+  82  Linux swap / Solaris
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux
 
[root@localhost dev]# ls
adsp       fd0u1680    initctl  midi      ram1     rawctl      stdin   tty20  tty36  tty51  ttyS0           vcsa
agpgart    fd0u1722    input    mixer     ram10    root        stdout  tty21  tty37  tty52  ttyS1           vcsa1
audio      fd0u1743    kmsg     net       ram11    rtc         systty  tty22  tty38  tty53  ttyS2           vcsa2
autofs     fd0u1760    log      null      ram12    sda         tty     tty23  tty39  tty54  ttyS3           vcsa3
bus        fd0u1840    loop0    nvram     ram13    sda1        tty0    tty24  tty4   tty55  urandom         vcsa4
cdrom      fd0u1920    loop1    oldmem    ram14    sda2        tty1    tty25  tty40  tty56  usbdev1.1_ep00  vcsa5
cdrom-hdc  fd0u360     loop2    par0      ram15    sda3        tty10   tty26  tty41  tty57  usbdev1.1_ep81  vcsa6
console    fd0u720     loop3    parport0  ram2     sdb         tty11   tty27  tty42  tty58  usbdev2.1_ep00  vcsa7
core       fd0u800     loop4    parport1  ram3     sdb1        tty12   tty28  tty43  tty59  usbdev2.1_ep81  vmci
disk       fd0u820     loop5    parport2  ram4     sequencer   tty13   tty29  tty44  tty6   vcs             vsock
dmmidi     fd0u830     loop6    parport3  ram5     sequencer2  tty14   tty3   tty45  tty60  vcs1            X0R
dsp        floppy      loop7    port      ram6     sg0         tty15   tty30  tty46  tty61  vcs2            zero
fd         floppy-fd0  lp0      ppp       ram7     sg1         tty16   tty31  tty47  tty62  vcs3
fd0        full        MAKEDEV  ptmx      ram8     shm         tty17   tty32  tty48  tty63  vcs4
fd0u1040   gpmctl      mapper   pts       ram9     snapshot    tty18   tty33  tty49  tty7   vcs5
fd0u1120   hdc         md0      ram       ramdisk  snd         tty19   tty34  tty5   tty8   vcs6
fd0u1440   hpet        mem      ram0      random   stderr      tty2    tty35  tty50  tty9   vcs7
[root@localhost dev]#
三、格式化磁盘区间
 
[root@localhost dev]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 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
 
Writing inode tables:  9/64
done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
[root@localhost dev]#
[root@localhost dev]# mkdir /mnt/sdb1
[root@localhost dev]# mount /dev/sdb1 /mnt/sdb1
[root@localhost dev]# cd /mnt/sdb1
[root@localhost sdb1]# ls
lost+found
[root@localhost sdb1]#
 
 
[root@localhost sdb1]# fdisk -l
 
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1521    12217401   83  Linux
/dev/sda2            1522        1553      257040   83  Linux
/dev/sda3            1554        1566      104422+  82  Linux swap / Solaris
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux
 
 
 
四、加载到系统启动项(重启磁盘自动挂载)
 
[root@localhost sdb1]# vi /etc/fstab
 
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/usr/local        /usr/local              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
LABEL=SWAP-sda3       swap                    swap    defaults        0 0
/dev/sdb1              /mnt/sdb1                ext3    defaults        1 2
# Beginning of the block added by the VMware software
.host:/                 /mnt/hgfs               vmhgfs  defaults,ttl=5     0 0
# End of the block added by the VMware software
~                                                                                                                           
~                      
 
重启生效检测                           
[root@localhost sdb1]# reboot  //重启生效
 
[root@localhost ~]# fdisk -l
 
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1521    12217401   83  Linux
/dev/sda2            1522        1553      257040   83  Linux
/dev/sda3            1554        1566      104422+  82  Linux swap / Solaris
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux
[root@localhost ~]# cd /mnt/sdb1              //成功
[root@localhost sdb1]# ls
lost+found
[root@localhost sdb1]#