UFS how can resize /usr partition (slice) in online?

cybermerlin

Member

Reaction score: 1
Messages: 35

Hi to all,
How can I resize /usr and /var partitions (slices) online (while server is running)?
Maybe with some special command from grub or...

I've never used the FreeBSD.live.CD before - is it possible? - give me, please helpful link.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 6,926
Messages: 28,850

Assuming it's UFS you can only resize them if there's free space adjacent to their respective partitions. Which typically isn't the case.

Please post the output of gpart show.
 
OP
OP
cybermerlin

cybermerlin

Member

Reaction score: 1
Messages: 35

I want to resize second part for escape some free space for the first part.
part6 - reduce
part4 - increase
Code:
   29360290   41943040     4  freebsd-ufs  (20G)
   71303330    4194304     5  freebsd-ufs  (2.0G)
   75497634   80870348     6  freebsd-ufs  (39G)
 

ShelLuser

Son of Beastie

Reaction score: 1,669
Messages: 3,510

That's most definitely not going to work while the server is running. For example: although there is growfs(8) which provides some kind of resizing, there's no "shrinkfs". So your only option for that is to make a backup, remove and re-create the partition and then restore your data.

This is also one of the many reasons why ZFS has become so popular; the filesystems all become virtual and share a common storage pool, so you'll never have to run into the problem that one has an excess and another is running out.
 
G

giahung1997

Guest


I want to resize second part for escape some free space for the first part.
part6 - reduce
part4 - increase
Code:
   29360290   41943040     4  freebsd-ufs  (20G)
   71303330    4194304     5  freebsd-ufs  (2.0G)
   75497634   80870348     6  freebsd-ufs  (39G)
With an online system it is imposible to accomplish what you want even on Linux. If you running from a live usb on Windows there are many partition software can do this type of job and on Linux with Gparted, but it's always risky and they're all asked you to have a backup before hit Apply button. The safest way and always works is what ShellUser told you, backup part 6 + part 5 contents via dd or dumpfs and delete it, extend part 4 then recreate part 6 + part 5 then restore. But I wonder, why you made such a illogical partition scheme?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 6,926
Messages: 28,850

I want to resize second part for escape some free space for the first part.
part6 - reduce
part4 - increase
Code:
   29360290   41943040     4  freebsd-ufs  (20G)
   71303330    4194304     5  freebsd-ufs  (2.0G)
   75497634   80870348     6  freebsd-ufs  (39G)
Not possible to do "online", not even possible to do without having to remove both 5 and 6 (losing the data).

In order for 4 to grow you're going to need to remove 5 and will need to recreate it. If 5 will be the same size, 6 will need to move. Because you can't move or shift partitions around you're going to have to remove 6 too.

Looking at the sizes, how much do you want to increase and decrease? Would it be an option to swap the data from 4 and 6? That will give you what you want without the hassle of having to remove and recreate the partitions. Only a couple of backup and restore procedures. You're going to have to do those anyway, regardless of the route you take.
 
Top