How to modify or resize a Windows or Linux partition
If you have two SE (Windows and Linux) on the same machine and you want to make changes to your Windows partition, then i advise you to make changes to your Windows partition from Windows. Do not touch your Windows partition with the Linux resizing tools.
To resize your Windows partition go to Computer > Disk
Management > right click on the Partition you
want > Extend-Volume or Shrink-Volume.
Now for the Linux Partitions :
We are going to see some ways to see how we can resize a Linux Partition without damaging our disk. But before we start please Backup your Data before you start doing anything.
1)How to resize partition and filesystem with fdisk and resize2fs
So let's start !! The system has two Disks wich they are :
- /dev/sda
- /dev/sdb
[root@f ~]# df
-h
Filesystem
Size Used Avail Use% Mounted on
/dev/mapper/vg_foo-LogVol01
13G 4.6G 7.7G 38% /
tmpfs
376M 0 376M 0% /dev/shm
/dev/sda1
485M 105M 355M 23% /boot
/dev/sdb1
494M 402M 67M 86% /yourpartitionname
1. Unmount the partition
[root@f ~]#
umount / yourpartitionname /
[root@f ~]# df –h
Filesystem
Size Used Avail Use% Mounted on
/dev/mapper/vg_foo-LogVol01
13G 4.6G 7.7G 38% /
tmpfs
376M 0 376M 0% /dev/shm
/dev/sda1
485M 105M 355M 23% /boot
2. Delete the partition
[root@f ~]#
fdisk /dev/sdb
WARNING:
DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for
help): d
Selected
partition 1
Command (m for
help): p
Disk /dev/sdb:
1073 MB, 1073741824 bytes
255 heads, 63
sectors/track, 130 cylinders, total 2097152 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:
0x2dbb9f13
Device Boot
Start
End Blocks Id System
Command (m for
help): w
The partition
table has been altered!
Calling ioctl()
to re-read partition table.
Syncing disks.
3. Create a new Partition
[root@f ~]#
fdisk /dev/sdb
WARNING:
DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for
help): n
Command action
e extended
p primary partition (1-4)
p
Partition number
(1-4): 1
First sector
(2048-2097151, default 2048):
Using default
value 2048
Last sector,
+sectors or +size{K,M,G} (2048-2097151, default 2097151):
Using default value 2097151
Command (m for
help): p
Disk /dev/sdb:
1073 MB, 1073741824 bytes
255 heads, 63
sectors/track, 130 cylinders, total 2097152 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:
0x2dbb9f13
Device Boot
Start
End Blocks Id System
/dev/sdb1
2048 2097151
1047552 83 Linux
Command (m for
help): w
The partition
table has been altered!
Calling ioctl()
to re-read partition table.
We created a new partition but we didn't finish yet, now we need to use the command resize2fs to successfully finish. Let's do it
4. Resize your filesystem with resize2fs
[root@fo ~]# resize2fs /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sdb1 to 1044192 (1k) blocks.
The filesystem on /dev/sdb1 is now 1044192 blocks long.
5. Re-mount extended partition
[root@fo ~]# mount /dev/sdb1 /yourpartitionname/
[root@fo ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_foo-LogVol01
13G 4.6G 7.7G 38% /
tmpfs 376M 0 376M 0% /dev/shm
/dev/sda1 485M 105M 355M 23% /boot
/dev/sdb1 988M 402M 536M 43% / yourpartitionname*
2) Resize with GParted
This is a
specialized distribution based on Debian that allows users to load GParted on any computer via an optical disc
or USB flash drive. It does not require any installation , it boots from the
media and runs solely in the RAM, but is able to resize partitions on any hard
drives that are attached to the computer. This is the best option, as it has
full access to the hard drives with minimal worry that something will break.
You can also install GParted via this command line :
sudo apt-get install gparted
Then you just have to open GParted let it scan your disk and just click on the partition you want to make changes to, then choose the option that goes with your needs and finally hit apply.
And for me i think this software is the best one. But you can also use KDE Partition Manager or Disks.
I hope this
article was helpful and for any suggestions leave a comment bellow
0 commentaires:
Post a Comment