|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
+ X% C/ ]" x' H or: fdisk /dev/sdc (for the third SCSI disk)3 E& h3 X1 Q* o6 ]5 j# S
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
, M+ ^$ ^ U2 H) F or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
! ^+ C7 q( m) P- o; ^6 D* P9 @; b ...
- ^. o g8 L" o3 v. a2 [0 l. H, q- df -k
9 M; ^ x+ O2 z/ D - df -lh9 B7 P4 Y; ]8 C; K8 h# V" n5 C
- 查看有几块硬盘:fdisk -l
5 ]8 A! |' \, F, j" j( w0 O
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 D$ P) Y! u. Y& s( U) b /dev/sda3 3723848 705968 2828716 20% /
9 M; H, g* U/ h( f3 e6 q2 E /dev/sda1 101089 9274 86596 10% /boot
3 S. a+ R4 l/ C. E# {& r none 14520 0 14520 0% /dev/shm
! O! f& {1 J1 B. Y: Q: J 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
9 n/ }& y5 l, @) |3 FDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
: `9 f( c* Q. o: L Z0 |( y Building a new DOS disklabel. Changes will remain in memory only,
q9 V0 q! W7 _ x until you decide to write them. After that, of course, the previous
( ~7 t5 a: A4 k8 j content won't be recoverable.; K; w+ U, b# S
The number of cylinders for this disk is set to 8322.
! A' o( j5 u9 B/ z# D( ` There is nothing wrong with that, but this is larger than 1024,
+ e! e0 u5 s. f( N and could in certain setups cause problems with:
5 g, r/ J4 J3 s* c- n8 E 1) software that runs at boot time (e.g., old versions of LILO)5 Q9 V$ H" R/ ^* P8 s& i
2) booting and partitioning software from other OSs
+ G' ^4 U8 A2 e J% A# g" Z (e.g., DOS FDISK, OS/2 FDISK)
+ y- i: P! Y) B/ r$ T" G$ n Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
( A4 R$ T/ Y7 x$ C+ E( d& G- Y Command (m for help): p6 z, A/ B" S; b% [. `
Disk /dev/hda: 4294 MB, 4294967296 bytes
8 @/ F: u0 x% D- ^! W* B 16 heads, 63 sectors/track, 8322 cylinders9 e- R/ j! X' B: K
Units = cylinders of 1008 * 512 = 516096 bytes
* g/ l9 N) I6 x- e$ C" `, M* x$ F Device Boot Start End Blocks Id System
" m. M5 w5 w9 w2 f* _ P Command (m for help): m3 l) J a/ B4 b5 Z
Command action
/ I6 B0 B$ `& j" M" q1 R a toggle a bootable flag
' R% M9 u' z; [4 O b edit bsd disklabel1 v9 w2 @1 V7 Z
c toggle the dos compatibility flag: S0 H2 q" Z5 u, h: e
d delete a partition
# m* D X% {2 ^ l list known partition types2 J% p7 ?. N4 }6 T
m print this menu
/ ?8 Y- u; T' t; {! { n add a new partition
7 M* q! p* @! j$ e1 | o create a new empty DOS partition table
" h+ U' ^1 s: r* s. d5 h* [ p print the partition table" m, _; a6 G' a4 z$ X1 W0 a
q quit without saving changes
/ u' R( F g6 i6 h s create a new empty Sun disklabel
7 o4 j1 x- ]1 C! O- o4 ~* ~ R t change a partition's system id i3 {1 G7 H8 J ~: Q* e
u change display/entry units0 {( g5 i4 c/ i# K- j
v verify the partition table% j/ o. b6 p: F. C* z
w write table to disk and exit9 |4 L M, A) [+ O! A8 j
x extra functionality (experts only)
& b2 ^6 ~, g ~) r6 x8 Y- E3 k Command (m for help): n
0 z& F5 m- }+ t: U: g Command action# g, h" \1 l- u. ~! D" f
e extended& z1 k: R6 }! L# t3 V4 y) {6 s- ?1 U
p primary partition (1-4)
" K& v6 W; {& F7 \ p! I/ j2 [' ]& P0 K- `
Partition number (1-4): 1 J; }( M! t2 X- W6 u
First cylinder (1-8322, default 1): / J+ Z1 T# C0 g3 K9 H
Using default value 1# w" r. O* u, P; Q( i! K9 p
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G9 a$ s4 y+ A8 V9 R# H, [3 Q
Command (m for help): p
. [, C `9 R# f) i- T Disk /dev/hda: 4294 MB, 4294967296 bytes9 [9 r6 H; O8 q" u0 w* c, O
16 heads, 63 sectors/track, 8322 cylinders) e( w" W6 e8 e @7 s9 t
Units = cylinders of 1008 * 512 = 516096 bytes' B7 i9 B" J" z0 U" z$ Q
Device Boot Start End Blocks Id System
+ ]0 G* r) |' @4 k' o) e7 Y7 [, N /dev/hda1 1 1000 503968+ 83 Linux
: ]$ \- X4 B4 p% V5 [# L8 u Command (m for help): w. m% t: X* V/ \
The partition table has been altered!1 q: Y4 \4 D Y8 k1 ^# C6 Q& n# [+ p
Calling ioctl() to re-read partition table.
- [4 U1 i1 b0 S! u! O Syncing disks.# d/ c l1 W; G1 B. v
//格式化新分区% n& B, w3 Y: V& N
mke2fs 1.32 (09-Nov-2002)' L# N) G* ^8 [# {% u8 e
Filesystem label=) n7 [7 a7 O: h! }
OS type: Linux7 |+ J: u2 `& \7 V, k& {! d* N
Block size=1024 (log=0)$ l1 Q- t/ h5 q( s0 s( T# O
Fragment size=1024 (log=0); n, N- s4 j" u- s9 N
126480 inodes, 503968 blocks
& r6 [& M% a$ Y4 r5 h. Y 25198 blocks (5.00%) reserved for the super user
5 i* O$ n( k4 j7 S! n r First data block=1
$ z, h0 h( O) I' g1 c; T 62 block groups
o& U2 |# h$ t% g% ? 8192 blocks per group, 8192 fragments per group
/ q% a8 x* C4 G, B 2040 inodes per group9 U6 ~" t2 n% h/ \0 a5 I( Z8 ~2 d
Superblock backups stored on blocks:
( I$ _, u9 w8 C2 {' @& a 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
' I( l4 p: N% `6 A# z% m Writing inode tables: done
1 ` k' s( w& B1 J6 E/ A- z+ a, q* \9 n Creating journal (8192 blocks): done
5 y S- F% Z/ C& |1 ^2 A- E Writing superblocks and filesystem accounting information: done
" `! b. k e% ^6 } This filesystem will be automatically checked every 30 mounts or
0 h( y( i2 \/ O3 f+ n m 180 days, whichever comes first. Use tune2fs -c or -i to override.
" e! I6 s4 Z5 G4 L文件系统 1K-块 已用 可用 已用% 挂载点
* L+ R4 a6 |& [! H /dev/sda3 3723848 705992 2828692 20% /
8 y3 P# p! W# X /dev/sda1 101089 9274 86596 10% /boot) H' H3 ~( A# m4 d/ y( L. o7 w# X' r
none 14520 0 14520 0% /dev/shm
# [) V; {) o* t5 J //挂上新分区
8 H' M/ O; y: s T( s& [2 @- mount /dev/hda1 /home# N$ S0 k% i/ m# N$ {. f1 P- h
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! W! z+ L p% @3 Y. H% z$ R /dev/sda3 3723848 705992 2828692 20% /! @# n( v# g- ~% G
/dev/sda1 101089 9274 86596 10% /boot2 d( d& F8 i( ]( {
none 14520 0 14520 0% /dev/shm
' H) [7 A" J3 E6 h' v# V /dev/hda1 488006 8239 454569 2% /home
4 @0 `3 H H7 S- r
|$ R$ S/ \ g1 G E$ L/ Y, N自动挂载:* ^! e9 {; ]6 E6 B
- vi /etc/fstab
3 U$ t3 W$ b% l- W' o7 O
\! ]3 M7 J& ?% o, @- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
5 [9 K" O9 ~- U& d Y( D
3 Y( S. P5 V0 l. C- K) d* m$ x0 z( d- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:. L+ K% P- g3 B( o8 N2 e1 R
- mount /dev/sdb5 /mnt/ljp1! r' p. V8 h% Y$ t- Q) b3 u
- - T! z: T8 @4 h ?7 p; w; s
- mount /dev/sdb6 /mnt/ljp2
复制代码 8 A+ s9 w% d2 ~
; T( z3 x' F/ H5 M5 N
$ j0 R4 j6 B% i8 R/ G: n; S3 S |
|