SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yeah that may work if they are exactly the same total size, which is harder than you think... You may need to use sfdisk to make it happen, or at least to find out what the sizes really are. fdisk may not report correctly.
Be sure to do everything at once, though. If you remove sdb1, sdb2 and quit fdisk sdb3 becomes sdb1. Of course the data is not moved on the disk. Instead a hole is left. When you create a new partition then it picks up this space as a starting point for the new partition. Usually lots of sectors get lost.
I think when gnashley said you'd "lose the info in the partitions" he meant that you'd lose the data in those partitions. That's pretty much a given if you delete a partition.
In any case, as you know, each partition starts and end at a particular point on the drive. Suppose sdb1 is currently defined as cylinders 1 through 100, sdb2 is 101 through 500, and sdb3 is 501 through 1000. (I'm just making up the numbers). If you start cfdisk, then drop sdb1 and sdb2, the result will be free space between cylinders 1 and 500. (This has no effect on sdb3, and you do not want to make any changes to sdb3, so leave it as is.) While still in cfdisk, you can then created two new partitions out of that free space, perhaps such as redefining sdb1 as 1 through 50, and sdb2 as 51 through 500. Be sure to specify the appropriate file system for each new partition (eg, swap, ext3, and so forth)
At this point sdb1 would occupy 1 - 50, sdb2 would occupy 51 - 500, and sdb3 would occupy 501 - 1000. Save your changes, reboot, and the result will be that you have taken space away from sdb1 and given it to sdb2. sdb3 will be the same as it was before. Not to keep repeating the same point, but as sys00's sig reiterates, be sure to make a backup of any important data.
Good luck with it. I've done this exact operation many times in the past, and although it may seem intimidating if you've never done it before, it actually is not that big of a deal.
I think when gnashley said you'd "lose the info in the partitions" he meant that you'd lose the data in those partitions. That's pretty much a given if you delete a partition.
Nope.
I don't presume to know what gnashley meant, but deleting partitions does NOT delete any data.
*NONE*.
You may lose the ability to address the data, but it's all still there until you over-write it.
Creating new partitions does not constituing over-writing the data.
Redefining partition(s) to cover the same space makes the data visible again.
I didn't mean that the data would actually be deleted, just that the pointer to it would be lost in the partition table.
If you deleted sdb2 and sdb3 and close fdisk without creating new ones and reboot, the data is still there. But, sdb4 may become sdb2 meanwhile. Even so, it's data hasn't been moved. Not until you create a new partition and format it will the data be overwritten. If the first partition you create afterwards is larger than the empty space between old sdb1 and sdb4, the partition will use the old space and use new space after the old sdb4 space to finish.
Of course all this means we are still trying to order the partitions physically which is illusion anyway. Still, you can make a mish-mash with uneeded fragmenting of the partitions. Also, as mentioned, because of the different way that different partitioning tools determine the geometry, you may get weird results sometimes and sectors may become lost.
If you know the geometry, using 512*cyl*heads*sectors (multiply by 2 and divide by 1024 twice to get MB) will let you size your partitions so they fall on logical cylinder boundaries and no sectors are unused and fdisk/fsck won't complain.
cfdisk may not be the tool to use for the job. fdisk might do better, though sfdisk is even surer.
For a 2GB difference I wouldn't try what you want.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.