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

 找回密码
 立即注册
查看: 2765|回复: 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)
$ |1 }' ]" i5 T8 o      or: fdisk /dev/sdc  (for the third SCSI disk); W+ J, w7 c0 X) ^) d8 y. G
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)% H3 q+ c2 Y1 f7 r& r
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)) C% t! Y5 z/ i9 i, L
      ...
" f8 c$ L% _8 t9 x; G# K' j
  1. df -k( ^$ f+ K$ @3 Z( X- L* p6 H
  2. df -lh/ H! g2 j1 ]0 g8 v. r
  3. 查看有几块硬盘:fdisk -l% _2 M( |, J. m- N+ E' w1 c/ `
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点; V( c3 ?& {0 u# c" C, R" V3 C
    /dev/sda3              3723848    705968   2828716  20% /8 d4 ^, N2 T( F" h6 s
    /dev/sda1               101089      9274     86596  10% /boot( _  R, V0 G/ e8 K% E, j: l, x
    none                     14520         0     14520   0% /dev/shm
2 F$ b, v; K) a6 p7 v    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
! G6 i6 ]7 s$ {6 P4 X# A  F
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
7 l; w; T, H, c% ^" K& {    Building a new DOS disklabel. Changes will remain in memory only,
, M- O- k  K  {0 G- F0 \    until you decide to write them. After that, of course, the previous
9 j. {+ B! b4 a4 _    content won't be recoverable.4 p$ [9 z( R5 |' f( R
    The number of cylinders for this disk is set to 8322.
9 H2 A# s8 T+ ~! v    There is nothing wrong with that, but this is larger than 1024,& J, F/ g  g6 B$ ^
    and could in certain setups cause problems with:: U: A+ Y5 F0 e# c! W
    1) software that runs at boot time (e.g., old versions of LILO)
: D8 a1 l& d9 B2 n4 Z0 a    2) booting and partitioning software from other OSs
  D, z) X/ c# d- `* o4 f) b       (e.g., DOS FDISK, OS/2 FDISK)* ^" i; t% g# n- o/ n
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- p% F: ?! x( {; H; x  ~    Command (m for help): p  G; F3 U5 j) Z6 |# I% U2 m" B
    Disk /dev/hda: 4294 MB, 4294967296 bytes6 s0 W' p" M1 ^4 L5 J, q- I+ H: C
    16 heads, 63 sectors/track, 8322 cylinders0 z) Z! O. S. q% w+ u
    Units = cylinders of 1008 * 512 = 516096 bytes/ y; I+ E- b+ v
       Device Boot    Start       End    Blocks   Id  System: E, s8 p5 d; J) J- l
    Command (m for help): m9 ]4 Q8 ]9 r( q  A$ n7 E
    Command action
' f% q6 l" b- `, K       a   toggle a bootable flag, S8 X7 x0 L9 `  i5 \3 o$ ?/ D' n
       b   edit bsd disklabel
2 v/ x) U5 S* K* r6 I2 V# A/ n       c   toggle the dos compatibility flag
+ P) F6 q- v8 L) r* s/ I$ Y       d   delete a partition! O- z( J' V$ B
       l   list known partition types# C' [2 L8 l, x% k
       m   print this menu
( ]% h1 ~& a1 [7 p, m8 D       n   add a new partition- \( O4 k' x* v4 L. L8 T' ]
       o   create a new empty DOS partition table( w$ G) H8 H. j3 ~
       p   print the partition table5 @( ?, Z/ w; U/ @2 X
       q   quit without saving changes
6 j5 W  c1 I( P2 _, `3 }+ W, L) U       s   create a new empty Sun disklabel2 H3 z* H  n( J" K/ R5 q+ B( Z+ w
       t   change a partition's system id  E8 }" ^9 W" o! q0 M
       u   change display/entry units# S4 g7 z1 Q5 \
       v   verify the partition table) O' z, Y3 d! e# @) Y( S6 v
       w   write table to disk and exit% E0 n( F: c! |% x% \
       x   extra functionality (experts only)6 N& s6 z2 z& s; w$ |
    Command (m for help): n3 q/ T; B/ B( ?9 w, e" ?* S, |
    Command action
* H% B1 W4 r! _4 p2 H1 v+ q9 P       e   extended
6 ^/ q" j: t. m$ j, ]       p   primary partition (1-4)
  \, g5 ?+ j# n    p) U- p7 G# d% f5 {+ g1 Z
    Partition number (1-4): 12 ^& E* I* s$ Y" M$ h2 V/ r6 u
    First cylinder (1-8322, default 1):
; C; q3 O+ ^2 \* O    Using default value 1
4 O8 b- N& l/ K) k- C* M    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G( s/ }2 `0 n6 q/ l% ]% t- }
    Command (m for help): p
- D* c5 n5 H9 r) `. P+ Y    Disk /dev/hda: 4294 MB, 4294967296 bytes+ y. G' C9 C# u( |: c% v; Z
    16 heads, 63 sectors/track, 8322 cylinders
$ a: Z7 h( d1 D+ I* W# ]: I! ]    Units = cylinders of 1008 * 512 = 516096 bytes
) X4 L. o$ ~/ t       Device Boot    Start       End    Blocks   Id  System
* d. n( q7 ?4 h0 Y! F    /dev/hda1             1      1000    503968+  83  Linux) D1 y* f: L. B* W% y
    Command (m for help): w- T/ R8 L3 j" B& E( f) B
    The partition table has been altered!  _+ r7 `: ?1 I! a; S' P0 @& m$ m2 e+ J
    Calling ioctl() to re-read partition table.! q2 A7 V2 m' T7 E9 @# o2 F
    Syncing disks., G# Q" C; A. R& T3 L* p
    //格式化新分区* J7 p- }. @/ c* C6 @
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
) l% C7 \2 C: G  G- C; `    Filesystem label=
& q$ n2 A& E$ @- Y$ s    OS type: Linux  w& V7 N  z' h3 {7 j0 ~( b
    Block size=1024 (log=0)' T; m# r6 i* P6 w, G4 M, {
    Fragment size=1024 (log=0)  L2 @& C# _  b+ Q  S' G; f
    126480 inodes, 503968 blocks
  ?7 t* ?3 r$ L1 H" H7 b    25198 blocks (5.00%) reserved for the super user+ M' U3 C5 v2 @8 |6 [
    First data block=19 l' }; F9 e2 r$ a
    62 block groups0 P/ o  H/ M3 Z& T& ^& Y
    8192 blocks per group, 8192 fragments per group
% K8 P* c' ]2 o! e! l, y4 U. \4 s    2040 inodes per group
3 T% a# `# }  k: R5 q" t( x    Superblock backups stored on blocks:
+ {+ u; y) v. R$ R' Y/ L            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ K. Q4 [% [  e: ]* B4 s( n    Writing inode tables: done                           
0 f9 l8 I1 [/ u- _/ J    Creating journal (8192 blocks): done
$ Z/ I' O. p0 B, t9 L    Writing superblocks and filesystem accounting information: done$ C; x9 c5 e8 i1 f# e# b
    This filesystem will be automatically checked every 30 mounts or
* k- \1 F: Q1 A8 Y! R+ j    180 days, whichever comes first.  Use tune2fs -c or -i to override.
% `& g/ Y; o# A2 I# r7 ?
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
/ K: {: L3 d) V7 M$ ~! t- b    /dev/sda3              3723848    705992   2828692  20% /
' }! D5 q) p  L& u0 M9 l) N    /dev/sda1               101089      9274     86596  10% /boot
3 \  o1 ^8 Y4 K+ z; X, R    none                     14520         0     14520   0% /dev/shm
- Z$ W$ q& \- ~: ~8 C6 M4 e    //挂上新分区9 C9 T- U3 C! S/ t' }( C1 K
  1. mount /dev/hda1 /home0 y$ ~" t# ?8 a" A: Q6 c. u+ }
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
; i4 Z/ v. L8 s, I( Q: E! Y! p# t    /dev/sda3              3723848    705992   2828692  20% /" ], H. q! M0 @9 g3 s
    /dev/sda1               101089      9274     86596  10% /boot
8 A; r0 k! T% w4 @$ [    none                     14520         0     14520   0% /dev/shm* Q; ~% Q" y- h. x& ^  G& i
    /dev/hda1               488006      8239    454569   2% /home
9 b. `! R5 b' @, [
4 f& p7 x& P$ u自动挂载:, g: B/ I! T$ |; r
  1.           vi /etc/fstab
    ' C6 C; G2 z: o1 \$ Y+ ~
  2. & M/ E; d5 j! ~
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0
    7 e6 s. h- K8 e2 a" e: I% O" t
  4. 5 S6 Q  x3 h1 l; k5 z$ A! L/ E* w
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
; n( q$ h5 K. w# h$ u: W( x
  1.           mount /dev/sdb5 /mnt/ljp1
    / V1 P, k0 Z7 G% m+ ^6 ^5 j

  2. / e7 H* Q* \( o" S, ?6 ?$ Z
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码
6 z+ W% p: f2 {, e( w1 G

- L) h4 g( ^" p& Y" e. K
0 a$ p5 P$ Y+ ~. l7 w
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-11 21:07 , Processed in 0.033789 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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