Re: How do I clone a drive and resize (downsize) a partition ? fdisk verify warning.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-06-24 at 02:06 -0600, Linuxguy123 wrote:
> I'm moving /, /boot and swap from a conventional hard drive to an SSD.
> 
> Both drives are 160 GB in size.
> 
> I want to resize the /boot and swap partitions from 200 MB and 2 GB to
> 500 MB and 8 GB respectively.   The first resize is because preupgrade
> now fails to run unless /boot is 500 MB or larger and the second because
> the swap file is supposed to be as big as the RAM in the computer and my
> laptop currently has 4GB and I want to upgrade to 8 GB in the future.
> 
> So... I partitioned the SSD to the appropriate sizes.   I then ran
> Clonezilla and installed the /boot data seemingly without any problem.
> I used the expert mode and told it to resize things to fit the new /boot
> partition size. 
> 
> Unfortunately, Clonezilla won't let me do the same for / because / on
> the SSD is 6 GB or so smaller than it was on the hard drive
> because /boot and swap are larger.
> 
> So how do I move ALL the data from / on the hard drive to / on the sdd ?
> 
> dd won't work because its for device files, not for partitions.  If I
> use dd between the devices, it won't resize anything.
> 
> Or should I do an outright dd and then use gparted to resize everything
> afterward ? 
> 
> Can one make cp copy EVERYTHING on one drive to another and keep the
> timestamps, etc, all correct ?
> 
> I think I did this once a few years ago using tar, but I can't remember
> how and I think it took up a lot of disk space and took forever to run.
> 
I have tried a couple of methods successfully, here are my "hints" files

I liked the fsarchiver method as I could save an "image file" containing a complete
replica of "/", it was only 8.5GB when compressed in my case
35mins to save the file, 20 mins to restore
Maybe of some help

John

1. From this list using cpio
2. Using fsarchiver

1. cpio
From:   gary artim <gartim@xxxxxxxxx>
Reply-to:       Community support for Fedora users <users@xxxxxxxxxxxxxxxxxxxxxxx>
To:     Community support for Fedora users <users@xxxxxxxxxxxxxxxxxxxxxxx>
Subject:        Re: change HDD without Re-installing Fedora 12 ..!!!!
Date:   02/25/2010 05:04:17 PM

Just uses create a mirror of a system I'm running. May help?! -- gary

## Add the new disk to the system
this example assumes a /dev/sda and (new) /dev/sdb
sda has 3 partitions, 1 swap, /boot, /. / and /boot are ext3 fstype.

## create new partition on new disk

parted (you need to set the partition type as gpt)
mkpart
## (model after target disk only larger, note: change the names (labels)
##  create 3 partition /, /boot, swap)

## make filesystem and copy

mkfs.ext3 /dev/sdb3
mount /dev/sdb3 /mnt
cd /
find . -xdev | cpio -pdumv /mnt
umount /mnt

mkfs.ext3 /dev/sdb1
mount /dev/sdb1 /mnt
cd /boot
find . -xdev | cpio -pdumv /mnt
umount /mnt

## mbr copy

dd if=/dev/sda of=/dev/sdb bs=446 count=1

## fix grub
## boot fc11 recovery dvd
## (need newer grub for gpt partition tables)
## assumes your first partition has grub installed on it
grub
root (hd0,0)
setup (hd0)
exit
###############################################################################
2. fsarchiver
fuerte hints_info 7# cat fsarchiver_partition_cloning_recipe
11_03_2010

Copied from ~/hints_info/backup_restore_summary
Boot from ssd1 or maybe rescueCD
Check selinux status
See http://www.fsarchiver.org/QuickStart - Execution environment
and http://www.fsarchiver.org/Attributes

Neither source nor destination are mounted

fsarchiver -o -j3 -z 6 savefs /tmp/fsarchive_sda7.fsa /dev/sda7

fsarchiver restfs /tmp/fsarchive_sda7.fsa id=0,dest=/dev/sda2,mkfs=ext3

fsarchiver copies the UUID be careful !!!!
tune2fs -U random /dev/sda2 as required

mount /dev/sda2 /mnt/zip
nedit /mnt/zip/etc/fstab                        Change UUID
nedit /mnt/zip/boot/grub/grub.conf      Change root (hdx,y) and UUID

grub            Check which disk is which by root (hd1,7) say to access a unique partition!
root (hd0,1)
setup (hd0,1)
Rebooted - the restored partition appears clean with SElinux enabled !!
-----------------------------------------------------------------------------------
fsarchiver - "is still in development, don't use it for critical data yet"
Installed fsarchiver on F12 fuerte and tried backup of 48GB part
Speed about 0.8 GB/min
fsarchiver -o -j3 -z 6 savefs /media/max80/fsarchive_sda7.fsa /dev/sda7
Can be used on a directory but is it better than tar?
fsarchiver -o -j3 -z 6 savedir /media/max80/fsarchive_ja.fsa /home/ja
------------
Installed fsarchiver on ssd1 and then with selinux enabled in permissive mode, sda7 unmounted
NB In future ideally selinux should be DISABLED
See http://www.fsarchiver.org/QuickStart - Execution environment
and http://www.fsarchiver.org/Attributes
These two URLs are very important reading - I don't understand them yet !
It is recommended to restore filesystems using fsarchiver from an environment where SELinux is disabled or not supported.
fsarchiver -o -j3 -z 6 savefs /tmp/fsarchive_sda7.fsa /dev/sda7
Timed at 34mins,  du -hs 21GB -> 8.5GB
fsarchiver restfs /tmp/fsarchive_sda7.fsa id=0,dest=/dev/sda2,mkfs=ext3
Restore took about 20mins! No errors given



> BTW: if I verify the partition table for the SSD, it tells me
> Remaining 5165 unallocated 512-byte sectors
> 
> Yet:
> Disk /dev/sdb: 160.0 GB, 160041885696 bytes
> 255 heads, 63 sectors/track, 19457 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x0001ab7d
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sdb1   *           1          66      530113+  83  Linux
> /dev/sdb2              67        1111     8393962+  82  Linux swap /
> Solaris
> /dev/sdb3            1112       19457   147364245   83  Linux
> 
> 
> Am I missing something ?
> 
> Thanks !
> 
No comment on above question - but do you not still have to align the
partitions to obtain the best performance on an SSD?




-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux