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

 找回密码
 立即注册
查看: 2591|回复: 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)
% z+ m2 l$ U: Y, b5 z! n6 C9 p" i/ H      or: fdisk /dev/sdc  (for the third SCSI disk)  b3 o$ l  n7 X: M6 u1 `
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
$ z/ N! _) X+ z/ Z( H- Q9 e      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
' T8 y" T9 R+ G: K  F8 e# Z      ...
$ a+ W7 g& w3 l# C, ?9 }3 L. V
  1. df -k$ y- f. t' a( a( n
  2. df -lh- A! N2 A$ D$ }9 w* W4 Y' o% D
  3. 查看有几块硬盘:fdisk -l& B5 e5 b! w' [0 U6 ~
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点1 ~: e4 z+ L1 ^
    /dev/sda3              3723848    705968   2828716  20% /
) q8 S4 w; ~0 N, Y& `) ]* W    /dev/sda1               101089      9274     86596  10% /boot0 u" p: x: r' {( t
    none                     14520         0     14520   0% /dev/shm! J* c. m2 q' D% X6 w0 V
    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! q" P( X: e2 W! ~; L5 T- d
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel4 a" y& F/ g* _# t' o
    Building a new DOS disklabel. Changes will remain in memory only,& ]/ W0 N: d6 v( a, r) C
    until you decide to write them. After that, of course, the previous: p( q" `& C$ e: j5 E* I2 i
    content won't be recoverable.8 u; P$ _% g  D* ?0 y
    The number of cylinders for this disk is set to 8322.* Q! S7 K- g  E  S
    There is nothing wrong with that, but this is larger than 1024,
5 r3 Z0 [2 W! t! T* ?4 ]5 _1 R/ K    and could in certain setups cause problems with:% x3 b* b) }" \' ?2 _
    1) software that runs at boot time (e.g., old versions of LILO)
# C' x" S' w& K: P    2) booting and partitioning software from other OSs- u1 E" K) `# q- g' U! r
       (e.g., DOS FDISK, OS/2 FDISK)
# B! j* j: @* S6 ~' k6 i# D    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
" i0 t6 m; i% }* s7 p    Command (m for help): p* W& E0 I" [1 m* ?
    Disk /dev/hda: 4294 MB, 4294967296 bytes
  V/ N6 O2 x$ y% D6 _2 O9 k    16 heads, 63 sectors/track, 8322 cylinders
% w% p- R( z' F. n    Units = cylinders of 1008 * 512 = 516096 bytes
( Q' x# n$ A* E9 ^& U7 B0 E( n       Device Boot    Start       End    Blocks   Id  System
0 V! y# N0 X6 M: X    Command (m for help): m6 W8 n1 m/ h5 d: o6 V2 _4 g+ V5 j4 A6 N
    Command action
# {* y: @6 L4 N* V7 [: M3 q       a   toggle a bootable flag  b2 \  D3 ]  ~9 {2 O7 d1 E6 p+ l$ _
       b   edit bsd disklabel7 }" |' v9 A3 c/ b$ s
       c   toggle the dos compatibility flag1 m2 m) A8 q, _9 A" @8 d% m
       d   delete a partition4 i0 h4 Q6 _5 V' C
       l   list known partition types0 G) y) g5 j* E! U8 J
       m   print this menu+ X! D8 K" h" P; h& f/ ]" Z
       n   add a new partition
0 f1 x& C! t. ~0 m' e  h% I( S8 ?7 B7 G       o   create a new empty DOS partition table0 H$ w" V" q+ A# c: z+ D
       p   print the partition table
: }% E/ H# e0 U2 ~1 x& r       q   quit without saving changes! C* M% I( X2 H! V0 M/ {
       s   create a new empty Sun disklabel) O* z* n+ c2 d& X8 p
       t   change a partition's system id! L7 w! d( C7 a: b( H' a: h
       u   change display/entry units
: I! i+ D, ~$ }3 |+ C4 C# P       v   verify the partition table* H  s# _0 ]1 a2 E) Q$ W
       w   write table to disk and exit
+ M0 b3 p& A; m. ~$ X7 r0 D       x   extra functionality (experts only)" k+ x! W) n4 N& R4 i) i
    Command (m for help): n! M9 L5 y" e0 L
    Command action* y9 o8 O9 L1 R. r4 U' q) i
       e   extended( D' o" ?( z* V9 _7 }! ~
       p   primary partition (1-4)
$ z/ B% a6 e6 X    p
! A0 H6 i2 `3 I( x. w    Partition number (1-4): 1
+ l# I  u4 [4 X& f3 G    First cylinder (1-8322, default 1): " ~$ B( Q+ w+ a" g# u
    Using default value 1
- q! a5 ], m# L/ j7 @    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
# j) x* |) m. P; F    Command (m for help): p
0 |+ z) k: |7 ?- j, k3 n! C    Disk /dev/hda: 4294 MB, 4294967296 bytes5 D- _. W2 m; s5 J  C) X
    16 heads, 63 sectors/track, 8322 cylinders( d' k  j2 E3 e7 Z' [
    Units = cylinders of 1008 * 512 = 516096 bytes
) Y, F) M: e# V2 V0 Y       Device Boot    Start       End    Blocks   Id  System) o( D  F/ n7 [' T7 b/ y8 Y7 [
    /dev/hda1             1      1000    503968+  83  Linux
3 U/ w2 ?) @! C& K! D- |    Command (m for help): w  P1 B, y4 e( H5 A
    The partition table has been altered!0 s6 }  P: m- q8 f5 Q
    Calling ioctl() to re-read partition table.0 z  G9 [- N7 p/ b6 {" ^9 H
    Syncing disks.( c# I0 v4 |/ Q
    //格式化新分区
- k7 A6 Q/ g9 N3 a) E
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
2 U2 ^3 N; _) L( B/ I; Z    Filesystem label=
! }9 \  `3 E2 j    OS type: Linux
$ Y. q5 Y9 @9 J, a    Block size=1024 (log=0)
0 U, U" U. Q' s+ M    Fragment size=1024 (log=0)
+ b$ {) S5 I2 m: {- D: P    126480 inodes, 503968 blocks9 s; ~- }9 V" }9 d3 e
    25198 blocks (5.00%) reserved for the super user
9 R1 Q. r* s( d0 ?  [* b- n% d    First data block=1
0 S- ^7 l2 ~3 f; X) n* n+ S; F' w    62 block groups6 K/ [; Y! P* u+ C$ K
    8192 blocks per group, 8192 fragments per group" t1 k/ ^/ V2 L" U
    2040 inodes per group
; N3 j1 A4 G  {7 q) I    Superblock backups stored on blocks: ; F. D! s8 T% s6 ]. B8 b8 v/ e; T
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
" X& \, B& n. |$ Q    Writing inode tables: done                            3 I, j1 F/ x8 _* j$ q5 b
    Creating journal (8192 blocks): done
" G. [' \0 M- q6 x" B: S    Writing superblocks and filesystem accounting information: done
4 ?6 V" ^' \5 l" n, E    This filesystem will be automatically checked every 30 mounts or
0 ~" P1 C5 \7 U. i; [3 d    180 days, whichever comes first.  Use tune2fs -c or -i to override.
' U( c5 R$ }! w, T8 Y3 \
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
7 M5 c' _& {! T; H, R& l    /dev/sda3              3723848    705992   2828692  20% /. h! {& J( a! L5 y( d9 ~0 S
    /dev/sda1               101089      9274     86596  10% /boot. g7 M3 Q" `1 c5 s) H! p
    none                     14520         0     14520   0% /dev/shm
9 r5 W( y0 ^: F8 v    //挂上新分区
" ~, Y- I& T) I5 U
  1. mount /dev/hda1 /home4 S9 A7 G" j5 ^& v
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点4 l7 r9 U0 M( s- D1 E) S0 h
    /dev/sda3              3723848    705992   2828692  20% /
+ M% k+ `$ w; G( r6 T    /dev/sda1               101089      9274     86596  10% /boot
8 _1 }" a( e  r# N9 o    none                     14520         0     14520   0% /dev/shm
0 z( f: S' i( _4 V    /dev/hda1               488006      8239    454569   2% /home
9 R; ~) ~9 g: o/ k1 i! G; E# Z1 m& ~8 x, R& w) h) y  H/ _
自动挂载:% I* F1 E  f* i# l) o: w; m4 g9 s
  1.           vi /etc/fstab- w5 N7 q, T# S( W4 f) V9 [
  2. & t2 Z; z2 T) {
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0$ ]' s# `. Y5 g; [
  4. / c2 v! l7 g# J! d, p
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:4 \0 X8 `' [5 f! R
  1.           mount /dev/sdb5 /mnt/ljp1/ ?; A7 j- p2 z( k# V: Y# `: ], |! @

  2. % E4 U- I( l3 ]4 R9 z5 N3 G5 x
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码
. K, e( K/ v5 M! ~

, r" a' p6 J. b4 J6 E3 U
  b( z) O6 ]7 W( M) H/ v4 T$ ~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-11-24 23:14 , Processed in 0.028093 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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