diff options
author | Blair Zajac <blair@orcaware.com> | 2013-03-01 00:28:35 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-03-01 00:28:35 -0500 |
commit | ddda1cacfd12c9d4f3dc63260819eda23be80e13 (patch) | |
tree | 50b48829403f1d809462be3580bb8daa25bd4f68 /tests | |
parent | 6a72a8677ad2e4e66669d2be93880643b0525b51 (diff) | |
parent | 0612a35c4190a485a95ebade8f5c0598ae8b0e14 (diff) | |
download | vyos-cloud-init-ddda1cacfd12c9d4f3dc63260819eda23be80e13.tar.gz vyos-cloud-init-ddda1cacfd12c9d4f3dc63260819eda23be80e13.zip |
Support resizing btrfs filesystems.
The existing code has two issues with btrfs:
1) The command to resize a btrfs filesystem uses a path to the mount
point, not the underlying device:
$ btrfs filesystem resize max /dev/vda1
ERROR: unable to resize '/dev/vda1' - Inappropriate ioctl for device
Resize '/dev/vda1' of 'max'
$ btrfs filesystem resize max /
Resize '/' of 'max'
2) The code that is given a path and finds the ID of the device where
the path is mounted doesn't work for btrfs:
Use /proc/$$/mountinfo to find the device where path is mounted.
This is done because with a btrfs filesystem using os.stat(path)
does not return the ID of the device.
Here, / has a device of 18 (decimal).
$ stat /
File: '/'
Size: 234 Blocks: 0 IO Block: 4096 directory
Device: 12h/18d Inode: 256 Links: 1
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-01-13 07:31:04.358011255 +0000
Modify: 2013-01-13 18:48:25.930011255 +0000
Change: 2013-01-13 18:48:25.930011255 +0000
Birth: -
Find where / is mounted:
$ mount | grep ' / '
/dev/vda1 on / type btrfs (rw,subvol=@,compress=lzo)
And the device ID for /dev/vda1 is not 18:
$ ls -l /dev/vda1
brw-rw---- 1 root disk 253, 1 Jan 13 08:29 /dev/vda1
So use /proc/$$/mountinfo to find the device underlying the input
path.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions