Raspberry Pi_Kor_15.1.1 파티션 관리


Published Book on Amazon


All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1

All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)

최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


15.1   논리적 저장장치 관리

 

15.1.1  파티션 관리

 

디스크는 독립적으로 관리되면서 논리적으로 분할된 공간인 partition으로 분할될 수 있다. partition "disk slices" 또는 "disklabel" 이라고도 부른다. partition 분할 결과는 disk sector 0에 있는 partition table에서 관리된다.

 

15.1.1.1    "fdisk" 명령 - 파티션 관리

 

시스템에 설치되어 있는 disk에 대한 partition 관리 작업을 할 때 fdisk 명령을 사용할 수 있다.  

 

[명령 형식]

fdisk  [ options ]   [ device ]

 

[명령 개요]

    시스템에 설치되어 있는 disk에 대한 partition 관리 작업을 처리한다.

    user 권한    -- super user. 

                                      

[상세 설명]

    device는 통상 "/dev/sda" "/dev/sdb"와 같은 형태이다. device name은 반드시 전체 disk를 지칭해야 한다.

    fdisk 명령은 menu-driven program 형식으로 사용할 수 있다.

    fdisk 명령은 DOS-type partition tables BSD-type disklabels 이나 SUN-type disklabels과 호환된다.

 

[주요 option]

-h

Print help and then exit.

-l

List  the  partition tables for the specified devices and then exit.  If no devices are given, those mentioned in /proc/partitions (if that exists) are used.

-s partition...

Print the size (in blocks) of each given partition.

-C cyls

 

Specify the number of cylinders of the disk.  I have no idea why anybody would want to do so.

-S sects

 

Specify the number of sectors per track of the disk.  (Not the physical number,  of course, but the number used for partition tables.)  A reasonable value is 63.

 

[사용 Example]

다음은 시스템에 있는 disk의 현재의 상태를 확인해 본 것이다. Disk partition을 확인할 수 있다.

 

pi@raspberrypi ~ $ sudo fdisk -l

Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes

4 heads, 16 sectors/track, 486192 cylinders, total 31116288 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009e011

 

        Device Boot      Start         End      Blocks   Id  System

/dev/mmcblk0p1            8192     1673828      832818+   e  W95 FAT16 (LBA)

/dev/mmcblk0p2         1679360    31050751    14685696   85  Linux extended

/dev/mmcblk0p3        31050752    31116287       32768   83  Linux

/dev/mmcblk0p5         1687552     1810431       61440    c  W95 FAT32 (LBA)

/dev/mmcblk0p6         1818624    17571839     7876608   83  Linux

/dev/mmcblk0p7        17580032    17743871       81920    c  W95 FAT32 (LBA)

/dev/mmcblk0p8        17752064    31047679     6647808   83  Linux

 

Disk /dev/sda: 1000 MB, 1000341504 bytes

16 heads, 32 sectors/track, 3816 cylinders, total 1953792 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *          32     1953791      976880    6  FAT16

 


 

다음은 device "/dev/mmcblk0"에 대해서 "fdisk" 명령을 메뉴 방식으로 진행할 수 있는 것을 보여 주고 있다. 여러 개의 내부명령을 사용하여 partition 작업을 하거나 현재 상태를 조회할 수 있다.  

 

pi@raspberrypi ~ $ sudo fdisk /dev/mmcblk0

Command (m for help):

Command (m for help): 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)

Command (m for help): p

Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes

4 heads, 16 sectors/track, 486192 cylinders, total 31116288 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009e011

 

        Device Boot      Start         End      Blocks   Id  System

/dev/mmcblk0p1            8192     1673828      832818+   e  W95 FAT16 (LBA)

/dev/mmcblk0p2         1679360    31050751    14685696   85  Linux extended

/dev/mmcblk0p3        31050752    31116287       32768   83  Linux

/dev/mmcblk0p5         1687552     1810431       61440    c  W95 FAT32 (LBA)

/dev/mmcblk0p6         1818624    17571839     7876608   83  Linux

/dev/mmcblk0p7        17580032    17743871       81920    c  W95 FAT32 (LBA)

/dev/mmcblk0p8        17752064    31047679     6647808   83  Linux


 

15.1.1.2    "cfdisk" 명령 - 메뉴기반 디스크 작업

 

시스템에 설치되어 있는 disk에 대한 partition작업을 할 때 "cfdisk" 명령을 사용할 수 있다

 

[명령 형식]

cfdisk  [ options ]   [ /dev/disk ]

 

[명령 개요]

    시스템에 설치되어 있는 disk에 대한 partition 분할 작업을 할 때 사용하는 명령이다.

    user 권한    -- super user.

 

[상세 설명]

    "cfdisk" 명령은 disk partition table에 대한 정보를 보여주거나 형태를 조정한다.

 

[주요 option]

-a

Use  an  arrow  cursor instead of reverse video for highlighting

the current partition.

-z

Start  with  zeroed partition table.  This option is useful when

you want to repartition your entire  disk.   Note:  this  option

does not zero the partition table on the disk; rather, it simply

starts the program without reading the existing partition table.

 


 

[사용 Example]

다음은 시스템에 있는 disk "/dev/sda"에 대해서 명령을 실행한 것이다. 해당 disk에 대한 정보와 현재 상태의 partition정보가 표시되어 있다. 화면 하단부의 메뉴를 이용해서 필요한 작업을 할 수 있다

 

pi@raspberrypi ~ $ sudo cfdisk /dev/sda

 

 



Leave a Reply