稳定互联,中美互联,站长交流,虚拟主机,香港主机,美国主机,虚拟空间,免费空间,免费VPS,免费域名

 找回密码
 立即注册
查看: 2805|回复: 0

[经验] linux下添加新硬盘方法

[复制链接]
发表于 2014-2-9 19:20:26 | 显示全部楼层 |阅读模式
  1. fdisk
复制代码
Usage: fdisk [-l] [-b SSZ] [-u] device    E.g.: fdisk /dev/hda  (for the first IDE disk)3 ]3 u6 k- n! c3 @' h9 n
      or: fdisk /dev/sdc  (for the third SCSI disk)
! G0 x6 K8 m+ K( S6 |      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)" w( Z8 Y- P/ v+ I; i- ^: Y
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
- L& ?" F: {" B( i      ...* x* }+ y' `. B5 ~+ F5 L6 u
  1. df -k1 v( h5 K- o  L) u6 T# x' y/ v
  2. df -lh
    % }) S$ w* T, w: U3 X
  3. 查看有几块硬盘:fdisk -l( N1 ?6 H  ~. x4 T( z' B& q
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
' ?0 k" @6 Q$ Z& b& {2 M    /dev/sda3              3723848    705968   2828716  20% /
" O7 o% Q5 I5 t& t    /dev/sda1               101089      9274     86596  10% /boot1 z4 F$ a$ t2 b0 F+ D
    none                     14520         0     14520   0% /dev/shm
6 h- ^1 x/ _; `% V% ^" V    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
: Y6 p& P* b9 e. f
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel" L7 A) C8 m- b) s% D
    Building a new DOS disklabel. Changes will remain in memory only,
/ `4 I5 U; N- L" B. O    until you decide to write them. After that, of course, the previous" `" L, Z2 \+ m% A8 g$ s
    content won't be recoverable.
# s4 X1 z0 v* a" O3 _    The number of cylinders for this disk is set to 8322.
5 q, j7 P. z# C1 c+ d    There is nothing wrong with that, but this is larger than 1024,- f9 @" L7 G' K! `8 B, R( p6 t
    and could in certain setups cause problems with:
+ X! u9 V: O% H! b! s, ~& E    1) software that runs at boot time (e.g., old versions of LILO)
8 ^$ V- g! D7 u7 V; l& X0 Y    2) booting and partitioning software from other OSs
1 X5 I6 ]& k8 T0 U4 U       (e.g., DOS FDISK, OS/2 FDISK)
4 A& c" Q% q  B5 X    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite). W; R8 i: |& n  Y  Q/ N3 q
    Command (m for help): p, D9 v0 }4 i3 r3 q! C8 D
    Disk /dev/hda: 4294 MB, 4294967296 bytes
1 Q0 d- }& H  _- F    16 heads, 63 sectors/track, 8322 cylinders
& n, H- @. p& Z9 g    Units = cylinders of 1008 * 512 = 516096 bytes
  i7 j! s( y, l( V1 U- ~5 w5 L$ Y       Device Boot    Start       End    Blocks   Id  System
' g- [/ M% J, Y4 R    Command (m for help): m3 G- {' X9 w' T9 V
    Command action, p- M+ m$ `0 C/ \# c
       a   toggle a bootable flag8 C% u5 Y6 v$ ?( s8 X& W8 L
       b   edit bsd disklabel
/ L8 v/ c0 m8 M3 [; ^6 R$ r       c   toggle the dos compatibility flag! x' e: J! V+ K, A, O
       d   delete a partition
: h/ V/ f0 R% R9 _8 Z       l   list known partition types/ k( x* }5 @) i. B" o; X0 _
       m   print this menu
2 U$ k1 w- u3 Y  X       n   add a new partition  X& R. D" Q3 v4 B
       o   create a new empty DOS partition table
6 @" [7 X* G2 v  I5 D) _5 T       p   print the partition table
. F' ?7 \4 l1 `. F2 \: E       q   quit without saving changes' x' U8 P2 X+ H  K9 l9 v& Z
       s   create a new empty Sun disklabel
, _3 I7 b$ ?( S4 _       t   change a partition's system id
  B) @* O9 f9 \' b# ]. l       u   change display/entry units0 Q7 Y, T  J9 v, H$ T
       v   verify the partition table
4 I- S; c$ O" o, n       w   write table to disk and exit' H" v  w/ l0 z
       x   extra functionality (experts only)
2 `8 A  f4 L# v, z, C+ w; j3 g    Command (m for help): n
5 {8 m& [& z7 ~3 i5 r$ d1 A* ~2 c    Command action
  z+ w7 A6 k, n% M  G       e   extended
7 ~' ~4 m7 V$ ^: F' R4 O: K5 M! h) \       p   primary partition (1-4)
) A$ N6 b2 J( V3 N2 o5 L    p$ g$ U+ h% r  n
    Partition number (1-4): 1; `+ Z% Y4 m, ^* {$ c- m
    First cylinder (1-8322, default 1): 4 Z  Z$ Y+ \, i4 x& W0 J: z* [, g0 j
    Using default value 1
2 Y* Y& B/ \- E$ b" F) c    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
9 g# s& v- x- U- X# v) ^6 W    Command (m for help): p
) }; W* [$ V' C5 h8 W- F  k9 P    Disk /dev/hda: 4294 MB, 4294967296 bytes
0 b9 }( h2 N, C! _+ v: n1 T    16 heads, 63 sectors/track, 8322 cylinders
$ ?% m  |) j4 Y  `, L) T7 H+ Q    Units = cylinders of 1008 * 512 = 516096 bytes
% F$ S+ s, M- u9 G" d( z& J       Device Boot    Start       End    Blocks   Id  System
9 L2 p1 t& o9 H( `) F    /dev/hda1             1      1000    503968+  83  Linux; V* d2 c( o! P
    Command (m for help): w% T+ O. W3 t6 V' r
    The partition table has been altered!. Q+ L. x7 E; y! \; a
    Calling ioctl() to re-read partition table.9 s# x" A8 P9 F. _1 q, _
    Syncing disks.
( z( l( F& i, P1 C    //格式化新分区# [7 T; I1 B3 {* {
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
& J. N; J# d& q5 F    Filesystem label=
4 e8 i/ I7 c. p; T, z0 I    OS type: Linux
$ f! |! w9 a, I! M; k8 r, X( x9 W    Block size=1024 (log=0)
6 L  t* C" F! z% |    Fragment size=1024 (log=0)
- L8 {% r# L- I' g; R    126480 inodes, 503968 blocks
) e  P# f" v6 W1 }* H5 U    25198 blocks (5.00%) reserved for the super user
8 C$ h. y: i7 D2 V& w5 U4 V" j6 ]    First data block=1
. s: ^0 S- r1 ]: `" W: t    62 block groups; h3 A: r+ _! G
    8192 blocks per group, 8192 fragments per group
% `; K! B: |3 w* z6 _    2040 inodes per group- g0 _! {6 P0 K8 D* c
    Superblock backups stored on blocks: - u9 X0 X3 K  c0 L8 D; C
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409! g3 y& |2 T5 x4 x
    Writing inode tables: done                           
4 I0 G) Y$ x8 f& w' X8 O& _    Creating journal (8192 blocks): done" @' R* S; ]  ]) p
    Writing superblocks and filesystem accounting information: done7 T8 l0 A' _5 b* s: `" }4 r/ v
    This filesystem will be automatically checked every 30 mounts or
7 u: @5 h- d  j; o( @/ W2 G    180 days, whichever comes first.  Use tune2fs -c or -i to override.
" S+ u: i# t6 u3 P' j6 X8 R. Y
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
* ?0 T( V% Y4 B$ c# A+ |    /dev/sda3              3723848    705992   2828692  20% /- v* w- H% h" d# _( g: U& ?
    /dev/sda1               101089      9274     86596  10% /boot: M6 l; z* }$ u- x" X
    none                     14520         0     14520   0% /dev/shm
- x) k, }4 ~) W3 q* u' m5 @    //挂上新分区
; L4 \% U) h4 y: l& I
  1. mount /dev/hda1 /home. K# p1 S$ L# a; O4 m  X8 A
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点: y! o7 X4 M& [* i3 _0 i8 h+ r
    /dev/sda3              3723848    705992   2828692  20% /3 }  _% }, Z( P
    /dev/sda1               101089      9274     86596  10% /boot$ q' G, T0 Y: B- M! E  N& ~
    none                     14520         0     14520   0% /dev/shm
7 ?6 W# s) E* @' I) x% W9 A$ K; p    /dev/hda1               488006      8239    454569   2% /home
# I3 X6 F) I3 U/ p3 {$ Y3 [) H/ G/ Y" w2 I  }& v
自动挂载:
6 `* n+ t/ Y, M- v: ]9 u
  1.           vi /etc/fstab
    + g; G4 x( U% b+ o: B* E( x) W
  2. ' j+ d& L' }" \( e
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0
    4 {5 L( `2 E0 d  _2 B; l

  4. ! ~* s& a/ U9 X( U) d% s7 P
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
0 m0 x9 z7 b& v6 L  ~5 [
  1.           mount /dev/sdb5 /mnt/ljp14 b* ]9 g/ S( T$ i7 B! P
  2. / E2 \5 A% j4 O# e5 O
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码

$ C3 m& D2 I6 o3 C4 ]# G" u
* [2 I* s# ?0 ?" t- Q! {0 ^( e7 D
& ^, Y- j" d' o+ r( h/ k  H
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|WdidcNet ( 苏ICP备17005075号-1 )

GMT+8, 2026-1-18 16:47 , Processed in 0.021211 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

快速回复 返回顶部 返回列表