Clone Linux fedora usando o Clonezilla

1

Na verdade, esta é a primeira vez para mim com o Clonezilla e não sou administrador do sistema. Eu tenho na minha máquina (estação de trabalho Win7 e Fedora22).

Cada vez que o Fedora Fedora mostra mensagens de tamanho de partição, então eu preciso cloná-lo para redimensionar meu HD e reinstalá-lo novamente com todos os meus pacotes. Para fazer isso eu estou usando Clonezilla, mas na verdade quando arrancar com Clonezilla, Clonezilla vê apenas a (s) partição (ões) do windows e meus dados de partição e não vê partições EXT4 do Fedora.

Nota: Além disso, se houver outra maneira fácil que eu possa alcançar meus requisitos, em vez do Clonezilla, isso seria ótimo.

    
por Just User 05.02.2016 / 18:54

1 resposta

2

Você pode redimensionar as partições com resize2fs para ext-x filesystems e ntfsresize para ntfs .

dd é uma boa opção para mover para as partições da esquerda com 10% de espaço vazio.

Por exemplo, para reduzir /dev/sda1 , mova para a esquerda e expanda /dev/sda2 :

  • lsblk : para identificar partições e verificar se elas estão desmontadas.
  • fdisk /dev/sda ou gdisk /dev/sda dependendo do tipo de tabela de partição e das letras p e q : para identificar os blocos sector size , alignment , start e end .
  • ntfsresize -s (new size) /dev/sda1 : para reduzir o sistema de arquivos /dev/sda1 .
  • dd if=/dev/sda2 of=/dev/sda bs=(sector size) seek=(new start) : para mover o sistema de arquivos /dev/sda2 para a esquerda.
  • Reduza /dev/sda1 , mova para a esquerda e expanda /dev/sda2 partitions com fdisk ou gdisk .
  • Expanda /dev/sda2 filesystem com resize2fs .

A fórmula para calcular o new start de /dev/sda2 é: (( /dev/sda1 start sector ) * sector size + new size of /dev/sda1 in bytes → alinhado a partition table alignment ) / ( sector size )

Exemplo da vida real (movendo e redimensionando /dev/sdc1 e /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.

Exemplo da tabela de partições 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.

Cuidado

Certifique-se de executar os comandos dd e ntfsresize sem interrupções.

Para preservar o IDs e o GUIDs pode ajudar você a manter o BCD de armazenamento do Windows Bootloader healthy. No pior dos casos, é relativamente fácil repará-lo usando um ambiente WindowsRE ou WindowsPE .

    
por 05.02.2016 / 21:43