How to create a partition for swap from existing partition
Im pasting my present partition details...
[root@gaurav ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Sun Aug 14 23:00:54 2011 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=3175289b-1554-4b5e-a519-066d48075c83 / ext4 defaults 1 1 UUID=4c83f32a-704c-4338-965a-9e5992546723 /home ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 [root@gaurav ~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on rootfs 7186 4176 2937 59% / udev 1488 0 1488 0% /dev tmpfs 1496 3 1493 1% /dev/shm tmpfs 1496 1 1495 1% /run /dev/sda5 7186 4176 2937 59% / tmpfs 1496 0 1496 0% /sys/fs/cgroup tmpfs 1496 0 1496 0% /media /dev/sda6 6890 588 5953 9% /home /dev/sda5 7186 4176 2937 59% /tmp /dev/sda5 7186 4176 2937 59% /var/tmp /dev/sda6 6890 588 5953 9% /home [root@gaurav ~]# fdisk -l Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x98000000 Device Boot Start End Blocks Id System /dev/sda1 * 2048 307202047 153600000 7 HPFS/NTFS/exFAT /dev/sda2 307202048 336500735 14649344 5 Extended /dev/sda3 336500736 409602047 36550656 7 HPFS/NTFS/exFAT /dev/sda4 409602048 625139711 107768832 7 HPFS/NTFS/exFAT /dev/sda5 307206144 322160639 7477248 83 Linux /dev/sda6 322162688 336498687 7168000 83 Linux ............................................................................. ............................................................................. 1)I want to create a new partition for swap out of /dev/sda5 . 2)The new partition thus created should be of around 2GB .(Also i would like to have a separate name for new partition ...eg./dev/sda7) 3)And finally i should be able to use that 2 GB for swap . (With my small research , i found out that this could be done by using fdisk to create a partition,and then using mkswap,swapon commands..) Plz guide me through the above procedure....(im new to linux :)) I ignored creating a swap space while installing fedora 15 kde 4.6.2... so plz help.. |
Hello g4ur4v, welcome to LQ,
delete the line Code:
/dev/sda5 7186 4176 2937 59% /tmp then execute Code:
umount /tmp Code:
fdisk /dev/sda Afterwards you can within fdisk creat a new partition, n for new partition, the size is made with +2G be sure to give it the partition-id 82. Create another new partition on the rest of the formerly sda5-partition. Exit fdisk with w. Reboot. Then edit /etc/fstab again. Insert a line Code:
/dev/sda? swap swap defaults 0 0 Execute Code:
mkswap /dev/sda? At next reboot the swappartition will be used automatically. Note that this all is very dangerous for people who are not experienced with Linux! You may loose all your data when you do something wrong with fdisk. Markus |
I may be reading this wrong but it looks to me like this could be problematic since your / is on sda5.
Quote:
Why not shrink sda6 and create the swap on a new partition, sda7? sda6 is only 9% used while sda5 is 59%. I would also second the warning by markush that you back up any valuable data before beginning anything as it is very easy to destroy data. |
Quote:
@g4ur4v: could you please tell us more about your Linux-system? how did you install it? is it new? you may consider a clean installation. Markus |
All times are GMT -5. The time now is 02:36 AM. |