설치를 sd 카드에 하는게 아니라 이미지 파일에서 작업하고 sd 카드로 한방에 심기위해서...
OS 이미지를 어떻게 만들었을까.. 하는 궁금증에서 시작...
1. 더미 이미지 생성
mercury Test # dd if=/dev/zero of=sdcard1g.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 11.23 s, 95.6 MB/s
mercury Test #
%% 주의할 점
SD 카드가 4 기가라고 4G 의 이미지를 만들었더니
용량이 너무 크다고 SD에 쓰지를 못 한다.
아마도 SD 카드의 용량보다 작은 사이즈의 이미지를 만들어
파티셔닝한 후 차후에 파티션 크기를 조정해주는 방식으로 해야할듯 하다.
2. 이미지 안에 파티션 생성
mercury Test # fdisk -l sdcard1g.img
Disk sdcard1g.img: 1073 MB, 1073741824 bytes, 2097152 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
mercury Test #
mercury Test # fdisk sdcard1g.img
Welcome to fdisk (util-linux 2.22.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x05dce6fe.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-2097151, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +64M
Partition 1 of type Linux and of size 64 MiB is set
Command (m for help): p
Disk sdcard1g.img: 1073 MB, 1073741824 bytes, 2097152 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: 0x05dce6fe
Device Boot Start End Blocks Id System
sdcard1g.img1 2048 133119 65536 83 Linux
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)
Command (m for help): p
Disk sdcard1g.img: 1073 MB, 1073741824 bytes, 2097152 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: 0x05dce6fe
Device Boot Start End Blocks Id System
sdcard1g.img1 2048 133119 65536 6 FAT16
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (133120-2097151, default 133120):
Using default value 133120
Last sector, +sectors or +size{K,M,G} (133120-2097151, default 2097151):
Using default value 2097151
Partition 2 of type Linux and of size 959 MiB is set
Command (m for help): p
Disk sdcard1g.img: 1073 MB, 1073741824 bytes, 2097152 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: 0x05dce6fe
Device Boot Start End Blocks Id System
sdcard1g.img1 2048 133119 65536 83 Linux
sdcard1g.img2 133120 2097151 982016 83 Linux
Command (m for help): wq
The partition table has been altered!
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
mercury Test #
mercury Test #
mercury Test # fdisk -l sdcard1g.img
Disk sdcard1g.img: 1073 MB, 1073741824 bytes, 2097152 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: 0x05dce6fe
Device Boot Start End Blocks Id System
sdcard1g.img1 2048 133119 65536 6 FAT16
sdcard1g.img2 133120 2097151 982016 83 Linux
mercury Test #
3. 파일시스템 작성
mercury Test # mkdir dos
mercury Test # mkdir ext4
mercury Test #
mercury Test #
mercury Test # losetup /dev/loop0 sdcard1g.img -o $((2048*512))
mercury Test #
mercury Test #
mercury Test #
mercury Test # mkfs.vfat /dev/loop0
mkfs.vfat 3.0.16 (01 Mar 2013)
Loop device does not match a floppy size, using default hd params
mercury Test #
mercury Test #
mercury Test #
mercury Test # mount -t vfat -o loop,iocharset=cp949 /dev/loop0 dos
mercury Test #
mercury Test #
mercury Test # umount dos
mercury Test #
mercury Test #
mercury Test # losetup -D
mercury Test #
mercury Test #
mercury Test # losetup /dev/loop0 -o $((133120*512)) sdcard1g.img
mercury Test #
mercury Test # mkfs.ext4 /dev/loop0
mke2fs 1.42.7 (21-Jan-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61440 inodes, 245504 blocks
12275 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
7680 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
mercury Test #
mercury Test # umount ext4
mercury Test #
mercury Test #
mercury Test # losetup -D
mercury Test #
mercury Test #
'운영_설치 > 리눅스_유닉스' 카테고리의 다른 글
로그아웃후에도 동작하도록 프로그램 실행 (0) | 2013.10.20 |
---|---|
스크립트에서 파티션 나누기 (0) | 2013.09.20 |
USB 메모리 사용을 위한 커널 옵션 (0) | 2013.09.19 |
locale (로케일 설정) (0) | 2013.09.05 |
리눅스(젠투) 로케일 관련... (0) | 2013.06.23 |