리눅스 파티션

리눅스 2013. 12. 2. 02:47
1. 파티션 확인

 

    1)fdisk -l /dev/hda  

       -> /dev/hda 의 파티션 내용을 확인한다.생략하면 모든 하드드라이브의 파티션을 보여준다.

 

[root@linux root]#fdisk -l

 

 Disk /dev/hda: 80.0 GB, 80060424192 bytes
 255 heads, 63 sectors/track, 9733 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

 Device        Boot   Start   End         Blocks        Id    System
 /dev/hda1     * 1            3824         30716248+     7    HPFS/NTFS
 /dev/hda2            3825   5099         10241437+   83     Linux
 /dev/hda3            5100   5230         1052257+    82     Linux swap
 /dev/hda4            5231   9733         36170347+    5     Extended
 /dev/hda5            5231   7055         14659281     fd     Linux raid autodetect
 /dev/hda6            7056   8880         14659281     fd     Linux raid autodetect
 /dev/hda7            8881   9003         987966       83     Linux

 

 2.  파티션 활용

 

 1)fdisk 실행

 

 [root@linux root]#fdisk /dev/hda  -> /dev/hda 파티션을 설정하기위해 실행

  The number of cylinders for this disk is set to 9733.
  There is nothing wrong with that, but this is larger than 1024,
  and could in certain setups cause problems with: 
  1) software that runs at boot time (e.g., old versions of LILO)
  2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

  Command (m for help): p <-- 'p' 명령은 현재 파티션정보를 보여준다.('fdisk -l' 과 같음)  

 

  Disk /dev/hda: 80.0 GB, 80060424192 bytes
 255 heads, 63 sectors/track, 9733 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

 Device        Boot   Start   End         Blocks        Id    System
 /dev/hda1     * 1            3824         30716248+     7    HPFS/NTFS
 /dev/hda2            3825   5099         10241437+   83     Linux
 /dev/hda3            5100   5230         1052257+    82     Linux swap
 /dev/hda4            5231   9733         36170347+    5     Extended
 /dev/hda5            5231   7055         14659281     fd     Linux raid autodetect
 /dev/hda6            7056   8880         14659281     fd     Linux raid autodetect
 /dev/hda7            8881   9003         987966       83     Linux


 

 2)새 파티션 생성하기

 

  Command (m for help): n <-- 'n' 명령은 새파티션생성시 쓰인다.
  First cylinder (9004-9733, default 9004):  <-- 시작실린더지점지정 그냥[enter]하면 default값.
  Using default value 9004
  Last cylinder or +size or +sizeM or +sizeK (9004-9733, default 9733): +100m
   <-- 끝나는실린더지정 혹은 직접 사이즈 지정할수 있다.

 

  Command (m for help): p <-- 확인  

 

  Disk /dev/hda: 80.0 GB, 80060424192 bytes
 255 heads, 63 sectors/track, 9733 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

 Device        Boot   Start   End         Blocks        Id    System
 /dev/hda1     * 1            3824         30716248+     7    HPFS/NTFS
 /dev/hda2            3825   5099         10241437+   83     Linux
 /dev/hda3            5100   5230         1052257+    82     Linux swap
 /dev/hda4            5231   9733         36170347+    5     Extended
 /dev/hda5            5231   7055         14659281     fd     Linux raid autodetect
 /dev/hda6            7056   8880         14659281     fd     Linux raid autodetect
 /dev/hda7            8881   9003         987966       83     Linux

 /dev/hda8            9004   9016         104391       83     Linux

   새로 생성된 파티션

 

 3) 파티션 삭제

 

 Command (m for help): d <-- 'd'명령은 파티션을 삭제하는 명령.

 

 Command (m for help): p <-- 확인  

 

  Disk /dev/hda: 80.0 GB, 80060424192 bytes
 255 heads, 63 sectors/track, 9733 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

 Device        Boot   Start   End         Blocks        Id    System
 /dev/hda1     * 1            3824         30716248+     7    HPFS/NTFS
 /dev/hda2            3825   5099         10241437+   83     Linux
 /dev/hda3            5100   5230         1052257+    82     Linux swap
 /dev/hda4            5231   9733         36170347+    5     Extended
 /dev/hda5            5231   7055         14659281     fd     Linux raid autodetect
 /dev/hda6            7056   8880         14659281     fd     Linux raid autodetect
 /dev/hda7            8881   9003         987966       83     Linux

 

 4)파티션의 system`id 지정

 

Command (m for help): t <-- ' t ' 명령은 system`id지정하는 명령
Partition number (1-8): 8 <-- 파티션 선택 (8은 /dev/hda8)
Hex code (type L to list codes): L <-- ' L ' 명령은 system`id 의 LIST 를 보여준다.


0 Empty                    1c Hidden Win95 FA  70 DiskSecure Mult bb Boot Wizard hid
1 FAT12                    1e Hidden Win95 FA  75 PC/IX be Solaris boot
2 XENIX root              24 NEC DOS            80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr               39 Plan 9                 81 Minix / old Lin c4 DRDOS/sec (FAT-
7 HPFS/NTFS            42 SFS                   85 Linux extended db CP/M / CTOS / .

                                               *

                                               *

                                               *

                                               *

                                               *
17 Hidden HPFS/NTF  63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep     64 Novell Netware    b7 BSDI fs fe LANstep
1b Hidden Win95 FA    65 Novell Netware    b8 BSDI swap ff BBT


 

Hex code (type L to list codes): fd <-- 원하는 코드를 입력 (fd  는 raid 이다)
Changed system type of partition 8 to fd (Linux raid autodetect)

 

Command (m for help): p <-- 확인  

 

  Disk /dev/hda: 80.0 GB, 80060424192 bytes
 255 heads, 63 sectors/track, 9733 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

 Device        Boot   Start   End         Blocks        Id    System
 /dev/hda1     * 1            3824         30716248+     7    HPFS/NTFS
 /dev/hda2            3825   5099         10241437+   83     Linux
 /dev/hda3            5100   5230         1052257+    82     Linux swap
 /dev/hda4            5231   9733         36170347+    5     Extended
 /dev/hda5            5231   7055         14659281     fd     Linux raid autodetect
 /dev/hda6            7056   8880         14659281     fd     Linux raid autodetect
 /dev/hda7            8881   9003         987966       83     Linux
 /dev/hda8            9004   9016         104391        fd    Linux raid autodetect

                                                                      system`id 가 변경됨을 알수 있다.

 

 5) 파티션 저장 하고 나가기

 

   Command (m for help): w <--' w ' 명령은 작업한 파티션정보를 저장하고 나가는 명령

  The partition table has been altered!

  Calling ioctl() to re-read partition table.

  WARNING: Re-reading the partition table failed with error 16: 장치나 자원이 동작 중.
  The kernel still uses the old table.
  The new table will be used at the next reboot.
  Syncing disks.
  [root@mail root]#

   ※저장후 재부팅해야 인식한다.

 

 6) 파티션 저장안하고 나가기

  

   Command (m for help): q <--' q ' 명령은 작업한 파티션정보를 저장하지않고 나가는 명령

 

  [root@mail root]#

 

 7) 기타 fdisk 내부에서 명령어 확인

 

  Command (m for help): m <-- 'm' 명령은 명령어들에 대한 도움말을 출력한다.
  Command action
  a toggle a bootable flag
  b edit bsd disklabel
  c toggle the dos compatibility flag
  d delete a partition
  l list known partition types
  m print this menu
  n add a new partition
  o create a new empty DOS partition table
  p print the partition table
  q quit without saving changes
  s create a new empty Sun disklabel
  t  change a partition's system id
  u change display/entry units
  v verify the partition table
  w write table to disk and exit
  x extra functionality (experts only)

출처 : bluetree`s linux

 

'리눅스' 카테고리의 다른 글

리눅스 기본명령어  (1) 2014.08.31
우분투 ftp  (0) 2014.06.24
apt-get  (0) 2014.06.05
diskpart 파티션  (0) 2013.12.02
vi 편집기 여러줄 주석처리  (0) 2013.11.22
블로그 이미지

왕왕왕왕

,