I would like to resize my /home ( /dev/sdb6 ) partition - without losing data - to make room to create a swap partition (at the moment, I don’t have any swap. Is it dangerous ?)
IIRC, it was possible to change partition sizes from the install disk in repair mode (?)
But I cannot find that repair mode on the 11.3 install disk. Has it been removed or is it somewhere deeper in the install or update process ?
Linux1:~ # fdisk -l
Disk /dev/sdb: 82.0 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000740a7
Device Boot Start End Blocks Id System
/dev/sdb1 1 901 7237251 b W95 FAT32
/dev/sdb2 902 2860 15735667+ 1c Hidden W95 FAT32 (LBA)
/dev/sdb3 2861 3643 6289447+ 83 Linux
/dev/sdb4 * 3644 9965 50780160 f W95 Ext'd (LBA)
/dev/sdb5 3644 6172 20304896 83 Linux
/dev/sdb6 6172 9963 30457856 83 Linux
Use Parted Magic to resize
Backup first
Make a note of current partitions and /etc/fstab and /boot/grub/menu.lst (just in case you need to refer to them)
You’ll need to add swap to fstab
Honestly, not really - not for a typical desktop system with a fair amount of RAM. How much memory is in your system?
If you have 1.5GB or more of memory, your system will likely never even use swap, unless there is something extra-ordinary using all your resources.
Also, you don’t really even need to add a swap partition, you can simply create a swap file and use that. There is not really much performance difference. You just create a flat file with dd, and then designate it as swap and activate it. Here is how: Linux.com :: Increase your available swap space with a swap file
This is waaaaaaay faster (and safer) than messing around with resizing partitions, etc.
Because the of ability to create such swap files when needed, these days I often don’t even bother making a swap file on some systems. It depends of course, a production server should certainly have swap, but a netbook would better just use the free drive space, etc.
Thanks. (But I don’t have a CD burner at the moment.)
Seeing that Parted Magic if free, wouldn’t it be a good idea to include it on the openSUSE install disks ?
I had a swap partition on another HDD, but due to a conflict with SCSI id when I added another drive, the swap partition is no more reachable. I’ll soon remove the last HDD I added for testing.
I have 768Mb, the max. the motherboard allow.
I haven’t had any problem so far using Linux without swap in the last 2 days.
(The +/- 600Mb swap partition was on another drive. I will get it back soon.)
You can do this using Gparted from within the running openSUSE that’s on your system.
Install Gparted
Log onto the system as root at the login screen.
Shrink home partition sda6, maybe 1 GB.
Close Gparted and in Yast’s partitioner, add a swap file in the vacated space at the end.
No need to adjust fstab because Yast’s partitioner will make an entry for swap.
I would reinitialise the bootloader too, because sometimes it gets cranky if partitions are added, even though it shouldn’t in this case, unlikely, but 1% chance.
Back up your data first because it’s easy to have finger trouble.
As you’ve noticed you don’t need a /swap partition to run Linux/OpenSuse. Also, mentioned above the faster method is to create a file(s) to add swap space.
man mkswap
man swapon
OpenSuse has Parted which is like PartitionMagic and Gparted allows you resize and create partitions.
Yes, thanks, but I don’t have a CD burner.
(I saw there is also a USB live version, but I don’t mind trying that because afterall, I don’t really need to resize my /home partition. )
#1 My error its not Parted it should be YaST Partitioner.
Sorry, not sure but, I think the YaST Partitioner will allow you to resize that partitions while its mounted, otherwise don’t commit or allow changes until you umount the /home.
Re: Mkswap That looks about right except remember to turn on the swap file :
swapon
I’ve always used the “bs=1024 count=307200” instead of 300mb.
So,
dd if=/dev/zero of=~/temp_file bs=1024 count=307200
307200+0 records in
307200+0 records out
314572800 bytes **(315 MB)** copied, 7.49181 s, 42.0 MB/s
You can log in as root, unmount the home partition from the command line (umount /dev/sdb6), resize it with Yast’s partitioner, create a swap partition with Yast’s partitioner. Yast’s partitioner takes care of the new entreis in fstab. End of job.
Log out of root user log on as normal user.
I wasn’t sure about YaST Partitioner and mounted drives, which of the partitioners had a command line option, etc.
Congratulations. looks like you resized and added the partition. Good experience either way.
Keep the mkswap file command in mind just in case you want more swap space or just resize the /swap partition again.