Problems copying/resizing hard disk with mixed ext3/xfs partitions
I want to replace the hard disk of my NAS driver with a bigger disk (1TB -> 2TB). The linux OS resides on the first 2GB, and the user shares on the rest. The user partition is XFS-formatted. I copied the contents of the old to the new disk using the dd command, and now need to resize the user partition, and hopefully also realign all partitions to match the new disk's 4096B sector size, since the old disk uses 512B sectors.
Here's the new disk's partition map, as reported by parted: Model: ATA ST2000DL003-9VT1 (scsi) The same disk as reported by fdisk: Disk /dev/sda: 2000.4 GB, 2000398934016 bytes I tried resizing the user partition 2 using gparted, but that failed (the resized disk wouldn't boot) so searching this forum I discovered xfs_growfs. Reading some posts here, I didn't understand how to use this. It seems I have to resize the partition first, and then regrow the filesystem inside the partition? I would then like to realign both partitions 1 and 2 to the new disk's 4096 sector size. I supposre I should first move the user partition 2 a few MB to realign it while resizing it, and then realign the linux partition 1? Many ideas? |
Quote:
In a situation like this, I recommend you preallocate the target partitions the way you want (alignment/size/filesystem), and use a filesystem-aware tool (rsync, cp, whatever) to copy the data. This way you will find out immediately if there are any errors in the source - something dd is unlikely to tell you about. Quote:
|
Thanks Syg00,
You mean something like the following: 1. Copy the first (63?) sectors containing the MBR using dd 2. Make the first extended partition starting on the first MiB boundary using parted, to solve the 4096B sector size problem 3. Create the internal logical partitions inside this partition using parted. 4. Create the XFS partition afer the first extended partition. How do I do this? 5. Copy the contents of each individual partition I was thinking, is there an easier way to do this? Is there a way to copy the contents of a partition to another disk, such that an offset on the destination disk can be specified? |
Any current distro (hint, you haven't told us yours), or probably better, liveCD will allocate new partitions properly aligned for you using any of the basic tools - parted included I would expect.
Tools like mondorescue or clonezilla will likely do the lot for you. To your specific q's: 1) *NO* - this is almost never needed; would also copy the partition table anyway. You don't want that. Reinstall the boot-loader from a install/liveCD after everything else is done. 2) let parted handle the alignment. 3) yep 4) parted (maybe think of rearranging - why not the xfs as a logical as well ?) 5) yep |
Many thanks,
I'll look at both Clonezilla and MondoRescue. |
All times are GMT -5. The time now is 12:54 AM. |