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)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 2056MB 2056MB extended
5 64.5kB 263MB 263MB logical linux-swap(v1)
6 263MB 271MB 8193kB logical
7 271MB 280MB 8193kB logical ext3
8 280MB 1152MB 872MB logical ext3
9 1152MB 2048MB 897MB logical ext3
10 2048MB 2056MB 8193kB logical
2 2056MB 1000GB 998GB primary xfs
The same disk as reported by fdisk:
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0004e029
Device Boot Start End Blocks Id System
/dev/sda1 63 4016249 2008093+ 5 Extended
Partition 1 does not start on physical sector boundary.
/dev/sda2 4024320 1953529855 974752768 83 Linux
/dev/sda5 126 514079 256977 82 Linux swap / Solaris
Partition 5 does not start on physical sector boundary.
/dev/sda6 514143 530144 8001 83 Linux
Partition 6 does not start on physical sector boundary.
/dev/sda7 530208 546209 8001 83 Linux
/dev/sda8 546273 2249099 851413+ 83 Linux
Partition 8 does not start on physical sector boundary.
/dev/sda9 2249163 4000184 875511 83 Linux
Partition 9 does not start on physical sector boundary.
/dev/sda10 4000248 4016249 8001 83 Linux
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?