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

 找回密码
 立即注册
查看: 2628|回复: 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)$ C+ j3 Z3 q4 O+ G, B) A% Q
      or: fdisk /dev/sdc  (for the third SCSI disk)! _% l) A! a, K$ u* O3 ]4 D
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)( a, s2 o' z- m* j- t: K
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
: z2 W) n+ K% c8 m  F1 ?      ...
/ k- V5 k0 E; h* B
  1. df -k
    - i, Z" a% P, `* _# Q# O% d
  2. df -lh! d) y7 t* m- d& J, u. T
  3. 查看有几块硬盘:fdisk -l4 g. V' D, B- E: o& A8 ]1 M( M
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
$ {; Y& A# Q, o' K/ k0 u4 k    /dev/sda3              3723848    705968   2828716  20% /4 I' ^6 D  c, H
    /dev/sda1               101089      9274     86596  10% /boot
( y3 M2 F- v% O( c  F    none                     14520         0     14520   0% /dev/shm- L, U5 b( o) T2 d
    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' g* a( N3 M- k6 t, J2 V5 ?; n
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
& l; v, e2 B: h    Building a new DOS disklabel. Changes will remain in memory only,
0 X8 x, s) g( T& V4 j    until you decide to write them. After that, of course, the previous
4 |- H  J, q5 l& u; E% G" S    content won't be recoverable.3 f* h+ ?1 a, i$ T9 N4 i
    The number of cylinders for this disk is set to 8322.+ z( x: r4 Z$ t4 S3 K
    There is nothing wrong with that, but this is larger than 1024,
& }& T) H- A5 Z, X$ R    and could in certain setups cause problems with:! R: h, o& c3 |1 M
    1) software that runs at boot time (e.g., old versions of LILO)# F/ ~. V$ n& ]7 l2 O! M
    2) booting and partitioning software from other OSs- w) v. i' M# ?8 f8 n
       (e.g., DOS FDISK, OS/2 FDISK)6 n' b1 v: |  d7 n7 r+ a6 V) e
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
2 s6 H# g% G8 q6 P( p    Command (m for help): p
( ~# I/ w& \4 T- q9 P) W    Disk /dev/hda: 4294 MB, 4294967296 bytes; ^1 a2 q" v$ }6 s9 ^
    16 heads, 63 sectors/track, 8322 cylinders! p% h) Q: a' x7 Q1 j
    Units = cylinders of 1008 * 512 = 516096 bytes
+ o( [$ @2 x6 D; H4 N       Device Boot    Start       End    Blocks   Id  System
+ v) o  u$ ?% T    Command (m for help): m) G- y3 K8 Q4 P4 ~2 h' b9 j& z9 q
    Command action
. U0 s# E) p: [( @. M: _       a   toggle a bootable flag% @4 H$ {# i5 M# D3 l- a9 t
       b   edit bsd disklabel
' V1 ]% y3 A+ e" U: M" P/ c& `) s       c   toggle the dos compatibility flag) V1 l" e" N- ^. ^- K6 P- s8 b
       d   delete a partition
* q  i: Y; f9 ]6 h9 a       l   list known partition types- N& a5 E6 j, j9 \4 R
       m   print this menu( L# ^6 K  L( G
       n   add a new partition
, w; X& \0 j4 G       o   create a new empty DOS partition table/ i5 T1 O3 ]2 u+ Y5 Q, p# g
       p   print the partition table5 L7 O. n$ _& q5 q9 q$ c
       q   quit without saving changes: O0 x6 s& p1 F1 p
       s   create a new empty Sun disklabel# `! r3 |* `; a2 b/ ]: _
       t   change a partition's system id2 O% j/ w) N' e
       u   change display/entry units
- x8 j5 b# t' v; @       v   verify the partition table2 t/ j0 r  w! G: n9 C, Z1 t
       w   write table to disk and exit1 b- Q* C4 F! `* V4 [( `4 i
       x   extra functionality (experts only)0 ~1 `! E' o5 Z+ n1 s! r4 m5 a7 }! J
    Command (m for help): n
4 w! ^- q$ Q- r: v4 J3 O    Command action7 L9 c0 F1 {+ S% \. M* m
       e   extended
. a6 [& i: a! n2 D, X  _' n       p   primary partition (1-4)4 v4 q6 }! r) K9 f5 ?" w
    p" V- @7 S' B2 Q" i
    Partition number (1-4): 15 {( N+ V" Z# T) F6 E
    First cylinder (1-8322, default 1): : f6 G+ }* \# Z+ F- q
    Using default value 1; w4 a' Z7 \) p+ I  m
    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
3 u9 x2 W( ~2 T, ~3 D    Command (m for help): p
5 ], ~5 \, b: g' t0 P1 t    Disk /dev/hda: 4294 MB, 4294967296 bytes
  R( A9 ?# K* J5 X2 P" p7 ^    16 heads, 63 sectors/track, 8322 cylinders3 Y' c. _2 p/ Y" b
    Units = cylinders of 1008 * 512 = 516096 bytes
6 D$ _1 i: t" E       Device Boot    Start       End    Blocks   Id  System
9 O/ {; L' U6 o" z1 I6 O; J1 E& i/ e    /dev/hda1             1      1000    503968+  83  Linux
& q/ w% i7 r8 c    Command (m for help): w; i8 O2 R4 G4 |  z9 G  C
    The partition table has been altered!9 x: d; D( Q$ \4 {7 w0 r
    Calling ioctl() to re-read partition table.
, @: K; S7 ^( R    Syncing disks.
* x; |: z* \3 s+ N    //格式化新分区, t! i& Z% Y) w0 |. f( s
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
2 H2 P  M, V* R% {# j) f- z    Filesystem label=. N' ~0 k- b" |/ j/ o
    OS type: Linux
; o/ y! e* u  b" G7 ], U/ W    Block size=1024 (log=0). V. L* d- O8 a8 N6 I7 U7 v. y) R+ N& l
    Fragment size=1024 (log=0), _8 h7 l) b' \  R9 W
    126480 inodes, 503968 blocks
. m5 G# W' L. x) D2 {  E* }    25198 blocks (5.00%) reserved for the super user
% A0 c3 y6 h- {& |    First data block=1" ]; v! p! K8 ]$ X; C* J+ A
    62 block groups
3 _$ ^3 h+ m5 }8 {4 r, Z  {    8192 blocks per group, 8192 fragments per group* x+ c6 U: Z$ i8 u
    2040 inodes per group
% S) X% J8 `5 I7 O6 j4 r- ~    Superblock backups stored on blocks: 1 i" @' ~" C+ d7 U- `' R
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% E* F+ I! b3 |3 M, Y    Writing inode tables: done                            - s# \0 n( a# n3 A3 M
    Creating journal (8192 blocks): done
% P3 \" c8 R0 d    Writing superblocks and filesystem accounting information: done
- D% F1 `* X9 {( ^- D    This filesystem will be automatically checked every 30 mounts or
1 f  n1 d2 f  J4 i    180 days, whichever comes first.  Use tune2fs -c or -i to override.) ?/ l, x  r7 L' Z1 q8 V) d
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点0 V7 h" S% [5 e
    /dev/sda3              3723848    705992   2828692  20% /- S) u; N3 x% _2 V/ B; U. M
    /dev/sda1               101089      9274     86596  10% /boot  k7 z# V- @" s% M& z0 I& E
    none                     14520         0     14520   0% /dev/shm+ U9 x3 ]4 f) Z/ w3 |6 [) e
    //挂上新分区
$ \9 M8 e6 V$ b( H, [- A  R
  1. mount /dev/hda1 /home2 i2 [2 Z0 `/ `
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点% {$ `  L9 z; \, {2 D, x
    /dev/sda3              3723848    705992   2828692  20% /9 Q- ~, `4 O) w- a! l
    /dev/sda1               101089      9274     86596  10% /boot
. H2 m4 X6 A1 j3 A0 c    none                     14520         0     14520   0% /dev/shm: \. z; G$ l  C7 e% |6 B
    /dev/hda1               488006      8239    454569   2% /home
5 o" T, }$ {- e5 M
7 u" R' l% b* F自动挂载:$ ~6 A/ R% Q: j9 V
  1.           vi /etc/fstab
    6 w" M# r: r- B7 K! Z. Z2 K  }
  2. ( O( `1 f/ _2 i' O. d5 ~
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 04 K  n3 [" k+ r  j* @3 P! b

  4. / `& ~- Q3 |7 t) g$ u/ u
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
$ ?) U! U: c# p7 [+ o. b* H
  1.           mount /dev/sdb5 /mnt/ljp1- z/ v, b6 J  N( k( t
  2. 8 K0 O& c8 ?  i- e+ ]4 S9 w
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码
6 {* X1 W9 D7 c
5 Z/ X7 V0 ^' o7 R1 S
; Q" A2 _" X$ R7 S2 {/ W' f6 u
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-3 01:34 , Processed in 0.008632 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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