Clonezilla를 사용하여 Linux 페도라 복제

Clonezilla를 사용하여 Linux 페도라 복제

사실 저는 Clonezilla를 처음 사용했고 저는 시스템 관리자가 아닙니다. 내 컴퓨터(Win7 및 Fedora22 워크스테이션)에 있습니다.

Fedora는 실행될 때마다 파티션 크기 메시지를 표시하므로 이를 복제하여 HD 크기를 조정하고 모든 패키지와 함께 다시 설치해야 합니다. 이를 위해 Clonezilla를 사용했지만 실제로 Clonezilla로 부팅하면 Clonezilla는 Windows 파티션과 내 파티션 데이터만 볼 수 있지만 Fedora의 EXT4 파티션은 볼 수 없습니다.

참고: 또한 Clonezilla 대신 내 요구 사항을 달성할 수 있는 다른 간단한 방법이 있다면 좋을 것입니다.

답변1

resize2fsext-x파일 시스템 및 ntfsresize파티션 크기 조정에 사용할 수 있습니다 ntfs.

dd좋은 선택이다왼쪽파티션에 10%의 빈 공간이 있습니다.

예를 들어 축소하려면 /dev/sda1왼쪽으로 이동하여 확장합니다 /dev/sda2.

  • lsblk: 파티션을 식별하고 마운트 해제되었는지 확인합니다.
  • fdisk /dev/sda또는 파티션 테이블 유형에 따라 gdisk /dev/sda문자 p및 :를 사용하여 및 블록 을 q식별합니다 .sector sizealignmentstartend
  • ntfsresize -s (new size) /dev/sda1: /dev/sda1파일 시스템을 축소합니다.
  • dd if=/dev/sda2 of=/dev/sda bs=(sector size) seek=(new start): /dev/sda2파일 시스템을 왼쪽으로 이동합니다.
  • 또는 를 사용하여 파티션을 축소하고 /dev/sda1, 왼쪽으로 이동하고, 확장합니다 /dev/sda2.fdiskgdisk
  • 확장 /dev/sda2파일 시스템을 사용합니다 resize2fs.

계산식은 다음과 new start같습니다 /dev/sda2. (( /dev/sda1 start sector) * sector size+ new size of /dev/sda1 in bytespartition table alignment) / ( sector size)

실제 사례(이동 및 크기 조정 /dev/sdc1도 가능 /dev/sdc2):

#identifying partitions and checking if they are unmounted
> lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdc      8:32   1   1.9G  0 disk 
|-sdc1   8:33   1     1G  0 part 
`-sdc2   8:34   1 910.5M  0 part

#identifying partition type, sector size, alignment, start and end blocks
> gdisk /dev/sdc
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sdc: 3963904 sectors, 1.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D276E14A-5EB2-42FB-89DF-A742B6199BC3
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3963870
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2099199   1024.0 MiB  8300  Linux filesystem
   2         2099200         3963870   910.5 MiB   8300  Linux filesystem

Command (? for help): q

#shrinking /dev/sdc1 filesystem to 100M
> ntfsresize -s 100M /dev/sdc1
ntfsresize v2012.1.15AR.5 (libntfs-3g)
Failed to set locale, using default 'C'.
Device name        : /dev/sdc1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 1073738240 bytes (1074 MB)
Current device size: 1073741824 bytes (1074 MB)
New volume size    : 99996160 bytes (100 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 6 MB (0.5%)
Collecting resizing constraints ...
Needed relocations : 1412 (6 MB)
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sdc1'.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
  1)  create it at the same disk sector (use sector as the unit!)
  2)  create it with the same partition type (usually 7, HPFS/NTFS)
  3)  do not make it smaller than the new NTFS filesystem size
  4)  set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.

#calculating the new start of /dev/sdc2 in bytes (/dev/sdc1 start block)*(sector size)+(new size of /dev/sdc1 in bytes)
> echo $((2048*512+100*1024*1024))
105906176

#checking alignment (new start in sectors)%(alignment*(sector size)) 0=aligned, >0=not aligned
> echo $((206848%(2048*512)))
0

#calculating the new start of /dev/sdc2 in sectors (new start in bytes)/(sector size)
> echo $((105906176/512))
206848

#moving /dev/sdc2 filesystem to the left bs=(sector size), seek=(new start in sectors)
> dd if=/dev/sdc2 of=/dev/sdc bs=512 seek=206848
1864671+0 records in
1864671+0 records out
954711552 bytes (955 MB) copied, 80.6772 s, 11.8 MB/s

#resizing and moving partitions preserving GUIDs (new start sector of /dev/sdc2 must match)
> gdisk /dev/sdc
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): i
Partition number (1-2): 1
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: 359B474B-0EE0-46B5-A105-A57C1D60E863
First sector: 2048 (at 1024.0 KiB)
Last sector: 2099199 (at 1.0 GiB)
Partition size: 2097152 sectors (1024.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'Linux filesystem'

Command (? for help): i
Partition number (1-2): 2
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: 93FD4BBB-F574-40D2-AC20-4FC162FDDEA3
First sector: 2099200 (at 1.0 GiB)
Last sector: 3963870 (at 1.9 GiB)
Partition size: 1864671 sectors (910.5 MiB)
Attribute flags: 0000000000000000
Partition name: 'Linux filesystem'

Command (? for help): d
Partition number (1-2): 1

Command (? for help): d
Using 2

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-3963870, default = 2048) or {+-}size{KMGTP}: 2048
Last sector (2048-3963870, default = 3963870) or {+-}size{KMGTP}: +100M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (2-128, default 2): 
First sector (34-3963870, default = 206848) or {+-}size{KMGTP}: 206848
Last sector (206848-3963870, default = 3963870) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): x

Expert command (? for help): c
Partition number (1-2): 1
Enter the partition's new unique GUID ('R' to randomize): 359B474B-0EE0-46B5-A105-A57C1D60E863
New GUID is 359B474B-0EE0-46B5-A105-A57C1D60E863

Expert command (? for help): c
Partition number (1-2): 2
Enter the partition's new unique GUID ('R' to randomize): 93FD4BBB-F574-40D2-AC20-4FC162FDDEA3
New GUID is 93FD4BBB-F574-40D2-AC20-4FC162FDDEA3

Expert command (? for help): p
Disk /dev/sdc: 3963904 sectors, 1.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D276E14A-5EB2-42FB-89DF-A742B6199BC3
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3963870
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   8300  Linux filesystem
   2          206848         3963870   1.8 GiB     8300  Linux filesystem

Expert command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.

#expanding /dev/sdc2 filesystem
> resize2fs /dev/sdc2
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/sdc2 to 469627 (4k) blocks.
The filesystem on /dev/sdc2 is now 469627 blocks long.

DOS 파티션 테이블 예:

#resizing and moving partitions preserving IDs and active flags (new start sector of /dev/sdc2 must match)
> fdisk /dev/sdc

Command (m for help): p

Disk /dev/sdb: 2029 MB, 2029518848 bytes
63 heads, 62 sectors/track, 1014 cylinders, total 3963904 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: 0x81dc6c28

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     2099199     1048576    7  HPFS/NTFS/exFAT
/dev/sdb2         2099200     3963903      932352   83  Linux

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

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): 1
First sector (2048-3963903, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-3963903, default 3963903): +100M

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): 2
First sector (206848-3963903, default 206848): 206848
Last sector, +sectors or +size{K,M,G} (206848-3963903, default 3963903): 
Using default value 3963903

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 07
Changed system type of partition 1 to 7 (HPFS/NTFS/exFAT)

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sdb: 2029 MB, 2029518848 bytes
63 heads, 62 sectors/track, 1014 cylinders, total 3963904 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: 0x81dc6c28

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sdb2          206848     3963903     1878528   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

경고하다

중단 없는 작동 dd과 명령을 보장합니다.ntfsresize

저축 IDs하고 건강을 GUIDs유지하는 데 도움이 될 수 있습니다 . 최악의 경우 사용이나 환경에 따라 고치는 것이 상대적으로 쉽습니다 .BCDWindows BootloaderWindowsREWindowsPE

관련 정보