Hello,
as you can see from
root-0:kullmann> df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 20G 18G 1009M 95% /
devtmpfs 1.9G 248K 1.9G 1% /dev
tmpfs 1.9G 252K 1.9G 1% /dev/shm
/dev/sda6 20G 18G 1009M 95% /
/dev/sda7 388G 113G 256G 31% /home
/dev/sda1 100M 25M 76M 25% /windows/C
/dev/sda2 50G 26G 24G 53% /windows/D
I need to enlarge the partition sda6 containing / and shrink the partition sda7 containing /home.
So I want to take away 20GB from sda7 and add it to sda6.
I have never done so. On the internet I can find only incomplete information, always starting with
some general advice (“save your data”), and then immediately jumping (degenerating) to advice which
buttons to click with some tool. The problem with that is this information is not generalisable, and one
doesn’t learn from it (no understanding is gained). I hope I can learn a bit (and do the job ;-)).
Especially I think it is appropriate to consider the hardware system underlying the file system as an
abstract data type, and it would be great to learn a bit about its operations.
First a bit of general information (can’t hurt):
root-0:kullmann> uname -a
Linux linux-vp82.site 2.6.39.3-0.5-desktop #1 SMP PREEMPT Sun Jul 31 02:04:11 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
Regarding the existing partitioning I have
root-0:kullmann> sfdisk -l
Disk /dev/sda: 60801 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 0+ 12- 13- 102400 7 HPFS/NTFS/exFAT
/dev/sda2 12+ 6527- 6515- 52326400 7 HPFS/NTFS/exFAT
/dev/sda3 * 6527+ 60801- 54275- 435956736 f W95 Ext’d (LBA)
/dev/sda4 0 - 0 0 0 Empty
/dev/sda5 6527+ 6789- 263- 2109440 82 Linux swap / Solaris
/dev/sda6 6790+ 9401- 2611- 20972544 83 Linux
/dev/sda7 9401+ 60800- 51399- 412861440 83 Linux
root-0:kullmann> fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x02c8b5aa
Device Boot Start End Blocks Id System
/dev/sda1 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 104859647 52326400 7 HPFS/NTFS/exFAT
/dev/sda3 * 104859648 976773119 435956736 f W95 Ext’d (LBA)
/dev/sda5 104861696 109080575 2109440 82 Linux swap / Solaris
/dev/sda6 109082624 151027711 20972544 83 Linux
/dev/sda7 151029760 976752639 412861440 83 Linux
root-0:kullmann> sfdisk -s
/dev/sda: 488386584
total: 488386584 blocks
Is that warning of sfdisk relevant?
Okay, so the first three primary partitions are taken by windows, and I don’t need to touch that.
While partition 4, sda4, is split into three logical partitions, sda 5-7, containing swap, / and /home.
I don’t know which operations are possible (recommended), but simplest seems to consider it as an array.
And the simplest operation should be to move a contiguous block to a different segment which does not
overlap. That is, the simplest way to proceed seems to
- Create a new partition sda8, size 120GB, at the end of sda4.
- Copy all of sda7 into sda8.
- Extend sda6 by 20GB at the end, and shrink sda7 by 20GB at the beginning. Don’t know
whether this is possible, but should be. Likely in this process sda7 is lost, but sda6 should be safe. - Copy sda8 into the new sda7.
- Delete sda8, and let sda7 take over its space.
I guess that should be possible using some tool which boots the system.
I have for example a CD with Parted Magic 6.0.
More data on the disk:
root-0:kullmann> mount | column -t
devtmpfs on /dev type devtmpfs (rw,relatime,size=1944248k,nr_inodes=486062,mode=755)
tmpfs on /dev/shm type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
/dev/sda6 on / type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sda7 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /windows/C type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/sda2 on /windows/D type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
securityfs on /sys/kernel/security type securityfs (rw,relatime)
gvfs-fuse-daemon on /home/kullmann/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
root-0:kullmann> cat /proc/partitions
major minor #blocks name
8 0 488386584 sda
8 1 102400 sda1
8 2 52326400 sda2
8 3 1 sda3
8 5 2109440 sda5
8 6 20972544 sda6
8 7 412861440 sda7
root-0:kullmann> hdparm -i /dev/sda
/dev/sda:
Model=WDC WD5000BEVT-75A0RT0, FwRev=01.01A01, SerialNo=WD-WXB1A60V9698
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=976773168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7
- signifies the current active mode
Strange that sda4 does not show up?
Hope you can give me some advice.
Thanks
Oliver